Please login or register.

Login with username, password and session length
Advanced search  

News:

You need/want an older version of sNews ? Download an older/unsupported version here.

Pages: 1 [2] 3 4

Author Topic: [TESTING] Template Mod v2 Multiple Layouts dB driven  (Read 10503 times)

centered

  • Guest
Re: [WIP] Template Mod v2
« Reply #15 on: February 04, 2008, 12:03:09 PM »

Jason I agree with Joost and Phimoz. (Personally)

But I'm glad you continue this great mod. I think the user is free of choose.
It's a wonderfull ideia put multiple templates in table, and user can switch to template as he wishes (by temporal time). Like Cristmas, Summer etc.

I like your ideia Jason.

Rui, sometimes you confuse me.  You agree with Joost and Philmoz that this is not a good idea, but then you think it is a wonderful idea. 

I am lost...
Logged

Joost

  • Guest
Re: [WIP] Template Mod v2
« Reply #16 on: February 04, 2008, 12:03:42 PM »

If files are faster, then why aren't text-databases more popular?  Why doesn't sNews store the articles in text files, and categories as folders?

Serverside caching, the way - as I recall - you've been exploring and like the one posted by Meint,  is in fact creating a text-database. ;)

The first sNews engine I've used has got a text-database. 1.3. However, after that it hasn't been maintained.
Logged

centered

  • Guest
Re: [WIP] Template Mod v2
« Reply #17 on: February 04, 2008, 12:07:56 PM »

1.4 textdb came out afterwards.  Then I have been trying to make a 1.5/1.6 version myself.. stupid substring isn't supported!

Again, why the reluctancy to store a template and css in the database?
Logged

Rui Mendes

  • Development,Testing, Support
  • Hero Member
  • *****
  • Karma: 195
  • Posts: 1009
  • sNews1.7
    • Comunidade Portuguesa
Re: [WIP] Template Mod v2
« Reply #18 on: February 04, 2008, 12:17:15 PM »


Rui, sometimes you confuse me.  You agree with Joost and Philmoz that this is not a good idea, but then you think it is a wonderful idea. 

I am lost...

I'm sorry Jason, don't get me wrong.

Personally I don't know if I will use this mod, because I'll expect several posts on Civil Engineering and lots of articles, but for my clients I'll put this mod for sure.
Logged
Need a Job on Europe. Linkdin - Facebook / Group

philmoz

  • High flyer
  • ULTIMATE member
  • ******
  • Karma: 161
  • Posts: 1988
    • fiddle 'n fly
Re: [WIP] Template Mod v2
« Reply #19 on: February 04, 2008, 12:29:47 PM »

As I see it, you would be adding an extra layer of complexity to the system.
Currently, If I want to update css or layout, I can make changes locally, and ftp results into correct place.

If developed locally, and stored in db, I would have to (in some manner) have a way of transfering my new stuff to update the online old stuff, without possibility of copy/paste error.

Really, it comes down to a similar rant over the net, about storing images in db, or their locations.
Granted, many, many images will bloat the db, and likely cause strain, whereas the code you are proposing, will be 'reasonably' negligible in  size.

It is why I used the word "personally" in my original reply. My personalchoice, rightly or wrongly, would be to store location not code.
Easier to write, easier to manage IMHO.. :D
Logged
Of all the things I have lost, it is my mind that I miss the most.

centered

  • Guest
Re: [WIP] Template Mod v2
« Reply #20 on: February 04, 2008, 12:47:19 PM »

I'll expect several posts on Civil Engineering and lots of articles

So your saying that this mod is bad for those using alot of stored data in the database??  I am trying to understand why is it bad compared to why it is good for others and your clients

As I see it, you would be adding an extra layer of complexity to the system.
Currently, If I want to update css or layout, I can make changes locally, and ftp results into correct place.

And that is not complex enough?

Write the index, write the css, possibly create the folders, upload it into the FTP, check permissions, refresh page, wish for the best.
This way:
Write the index, write the css, Control-a, control-c, go to browser, control v, save (or command for the apple users)

Wow this is how CMSmadesimeple and Textpattern does this...

If developed locally, and stored in db, I would have to (in some manner) have a way of transfering my new stuff to update the online old stuff, without possibility of copy/paste error.

Would that error also come from the FTP program too?  FTP copies your files then pastes them on the server.  What is the difference?

I think there is more chance of a mess copying and pasting line by line mods than selecting an entire html file and pasting it.

Really, it comes down to a similar rant over the net, about storing images in db, or their locations.
Granted, many, many images will bloat the db, and likely cause strain, whereas the code you are proposing, will be 'reasonably' negligible in  size.
Agreed, I wouldn't store an IMAGE in the database, but I would store text in the database. 

This is text until it is processed:
Code: [Select]
<div id="logo"><h1>[func]s:|:website_title[/func]</h1></div>Or
Code: [Select]
body { background: #fff; }
Quote
It is why I used the word "personally" in my original reply. My personalchoice, rightly or wrongly, would be to store location not code.
Easier to write, easier to manage IMHO..

You have voiced your personal opinion, I am voicing mine.  But i do question and seek knowledge, because perhaps my idea may be wrong.

Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
Re: [WIP] Template Mod v2
« Reply #21 on: February 04, 2008, 02:43:15 PM »

@ EQ.... I don't think anyone is saying that your idea is... "bad" or "wrong". I think it's more a question of efficiency... as in is one approach more efficient than the other in terms of resource consumption (load) and where the consumption (loading) occurs. For me... it doesn't matter a whole bunch where the load is (server or users memory, etc.) as long as the site continues to peform without adverse affects.

Being able to create new mods - for sNews or any other CMS - is fun. It allows you to create new features that you want to have in your CMS. You do it first for yourself and... with sNews... you share it with your fellow members in case they might like to use it too. That doesn't mean we all (fellow members) will find it useful.

In my case... I would not use this mod in a client's site mainly because my clients are not script writers... they just want to add, edit and delete content. If they want different templates for each category, then I would make and provide the templates as hard-coded files and they are happy. Templates do not need to change on a daily basis as content does... once they are ready for use... they stay that way... so they are fine as static files. I take care of FTP'ing file changes to their sites for them... they don't want or need to FTP anything.

I base my "personal opinions" on the premise that the templates are something the developer takes care of just like the rest of the backend stuff.  :)
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

Fred K

  • Still trying to learn stuff
  • ULTIMATE member
  • ******
  • Karma: 130
  • Posts: 2728
    • Personal
Re: [WIP] Template Mod v2
« Reply #22 on: February 04, 2008, 03:13:37 PM »

Quote from: Keyrox
the premise that the templates are something the developer takes care of just like the rest of the backend stuff

I'd agree with most of what Key's just said. As for the mod (or mods) itself, I'm going to test run v1 before I say anything. But from the mod post it appears as if template _creation_ is done within the Admin interface, and that's where my mind cringes a little. Probably just gut reaction, or not grasping the concept fully, and as I said, I'm going to test it first.
Logged

centered

  • Guest
Re: [WIP] Template Mod v2
« Reply #23 on: February 04, 2008, 04:37:54 PM »

In my case... I would not use this mod in a client's site mainly because my clients are not script writers... they just want to add, edit and delete content. If they want different templates for each category, then I would make and provide the templates as hard-coded files and they are happy. Templates do not need to change on a daily basis as content does... once they are ready for use... they stay that way... so they are fine as static files. I take care of FTP'ing file changes to their sites for them... they don't want or need to FTP anything.

I base my "personal opinions" on the premise that the templates are something the developer takes care of just like the rest of the backend stuff.  :)

Right, Fred made the same statements when I started version 1 of this mod, and I included a on/off switch to turn the whole thing on or off.  When it's off, it looks like a normal installation.

Not saying this is wrong or right, but what is the best way of making this easier for users and better for everyone.

Fred try it out and come back to me.  Turn the thing on to use it

UPDATED!!
Here is my to do list:
1. Change main_temp to function as “Show on all categories and article pages”   DONE
1a. Remove main_temp from db table DONE
1b. If checked, then make all templateids in 3 to the selected template  DONE
2. Remove templateid from articles and categories table (my version)  DONE
3. Add new table tempAssoc – with fields (id, name, categoryid, catorder, articleid, templateid)  DONE 
4. Add to new table the default pages  DONE
4a. Add to processing new insert and update into processing for tempAssoc
     ------- Template DONE
     ------- Categories/Catorder/Articles – Need to be done
----------------------------------------------------------------------------
5. Add select box for templates to form_articles/categories - If template editor is on
6. Add new admin section (function) called Structure.  Show entire site structure similar to sitemap, have select boxes with templates to be selected.  Have save button at end. If template editor is on
7. Add 5,6 to processing. If template editor is on
8. Add new function to determine template id.  Utilize Joost's function for multiple layouts.  Return the $templateid.  If template editor is on
9. Adjust index(), css_links(), and check_default() for new sql: id=$templateid
10. Test.
« Last Edit: February 04, 2008, 08:32:52 PM by equilni »
Logged

Fred K

  • Still trying to learn stuff
  • ULTIMATE member
  • ******
  • Karma: 130
  • Posts: 2728
    • Personal
Re: [WIP] Template Mod v2
« Reply #24 on: February 04, 2008, 08:32:54 PM »

Jason, I can't use this package. Here's what I did:

  • Downloaded file from location (see mod v1 post)
  • Created new database, populated it with template-editor.sql from package
  • Edited snews.php in package to match my test installation
  • Stored snews.php and index.php in test folder, made sure test folder is read/write for all (777)
  • Created .htaccess with correct RewriteBase line
  • Went to localhost:8888/test-folder/ in browser
  • Clicked login link

This is what I got:
Quote
Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, you@example.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Apache/2.0.59 (Unix) PHP/5.2.5 DAV/2 Server at localhost Port 8888

So you see, I cannot use his package...
Ideas?

EDIT:/* Just to confirm that things are ok, generally, I switched to another database and copypasted in some code from another template in the index file. Works perfectly. So there's something wrong witht the package files. */EDIT

EDIT 2:/* Just tried with converting text encoding in all files to UTF-8 instead of since that's what I always set my db collation to, and also checked that line endings were set to Unix, 'cause that usually works. I even went so far as to copypaste all of the code into fresh documents to make sure that UTF-8 encoding and Unix line endings would stick (sometimes they don't) ... and I still get Error 500 ...*/EDIT
« Last Edit: February 04, 2008, 08:51:56 PM by Fred K (agentsmith) »
Logged

centered

  • Guest
Re: [WIP] Template Mod v2
« Reply #25 on: February 04, 2008, 08:47:56 PM »

Fred,

Can you:
1. Redownload or unzip the package
2. Create db and add your db information to sNews.php
3. Run it normally before you try anything fancy.

I built this on a Mac so this so should as is.
Logged

Fred K

  • Still trying to learn stuff
  • ULTIMATE member
  • ******
  • Karma: 130
  • Posts: 2728
    • Personal
Re: [WIP] Template Mod v2
« Reply #26 on: February 04, 2008, 09:16:37 PM »

Yeah, it works when I manually unzip the archive. Auto-decompressing (when download link is simply clicked) didn't work. Usually it just works though...

Anyway, my only note so far is regarding the "Attach stylesheet" feature in the Template Editor. It has no option control -- as far as I can tell (but I might be misunderstanding things) there's no way to unattach a stylesheet that is attached to a template? If you look at the basic template, there are two stylesheets attached to it. Now, suppose I edit them to merge the two into one basic stylesheet ... I can't unattach the one that I don't need ... unless I go over to the stylesheets panel and delete the unwanted stylesheet? Is that a correct understanding, or am I out to lunch? :P

(Which reminds me, completely off topic, that I need to make dinner...)
Logged

Fred K

  • Still trying to learn stuff
  • ULTIMATE member
  • ******
  • Karma: 130
  • Posts: 2728
    • Personal
Re: [WIP] Template Mod v2
« Reply #27 on: February 04, 2008, 09:19:27 PM »

Side note -- if default charset is set to UTF-8 in sql file, then snews.php and index.php files should be saved with UTF-8 encoding as well. Otherwise it is likely that there will be problems with 'foreign' characters -- accents, diacritics, whathaveyou.
Just thought I'd mention it.
Logged

centered

  • Guest
Re: [WIP] Template Mod v2
« Reply #28 on: February 04, 2008, 10:03:06 PM »

Anyway, my only note so far is regarding the "Attach stylesheet" feature in the Template Editor. It has no option control -- as far as I can tell (but I might be misunderstanding things) there's no way to unattach a stylesheet that is attached to a template? If you look at the basic template, there are two stylesheets attached to it. Now, suppose I edit them to merge the two into one basic stylesheet ... I can't unattach the one that I don't need ... unless I go over to the stylesheets panel and delete the unwanted stylesheet? Is that a correct understanding, or am I out to lunch? :P

Thanks for looking at it.  I will check it out.  I didn't note that problem before, but I will test when I get back home. 

Overall what was your opinion?
« Last Edit: February 04, 2008, 10:05:18 PM by equilni »
Logged

centered

  • Guest
Re: [WIP] Template Mod v2
« Reply #29 on: February 04, 2008, 10:03:34 PM »

Side note -- if default charset is set to UTF-8 in sql file, then snews.php and index.php files should be saved with UTF-8 encoding as well. Otherwise it is likely that there will be problems with 'foreign' characters -- accents, diacritics, whathaveyou.
Just thought I'd mention it.

hmm I think smultron is doing a number on my files....

Also seeing 3 out of the 4 top mod threads about multiple templates, I think there may be a market for this mod....
« Last Edit: February 04, 2008, 10:07:05 PM by equilni »
Logged
Pages: 1 [2] 3 4