Two different code-sets (or multiple fields) for templates?
Posted: 07 July 2008 01:37 PM   [ Ignore ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  876
Joined  12-14-2004

Here is an interesting thought I had…

It might be very useful if you could have two different sets of code for one template. For example, what if I wanted my “regular” index template and my “event coverage” index template?

Right now (I think) I would have to create a second template called, say, index_event_coverage and load the event coverage code into there. Then, when I needed that template to be the index, I would need to rename index to index_regular and then rename index_event_coverage to index. Then, when the event was done, I would need to reverse that.

But what if a template could have two fields (or more if the user wants, similar to weblog custom fields) and you could give each field a name. Then, you could go in and switch which field was active.

So, using myself as ex example. I could have our standard index template. Then, when we are covering E3, we could have our pre-loaded E3 index page go active, and when it is over, change back. Then when it is time for CES, do the same thing, but with our CES template “field”.

This would be awesome for times when you know a template will need to be changed in advance, and you know what content will need to be on that template - or how it would need to be laid out, etc.

Could even help with working on a redesign. You could have a second field in all your templates once all the coding is done, and then set them all to go active tomorrow night at midnight, all at the same time.

Am I making sense here? smile

 Signature 

Love gadgets, technology, and pop culture? Visit us at Gear Live: http://www.gearlive.com

Profile
 
 
Posted: 07 July 2008 02:05 PM   [ Ignore ]   [ # 1 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15368
Joined  05-15-2004
drusoicy - 07 July 2008 01:37 PM

It might be very useful if you could have two different sets of code for one template.

I don’t think that’s feasible, to be honest. Also, potentially very confusing.

For example, what if I wanted my “regular” index template and my “event coverage” index template?

You use two templates. Note that your “index” template could consist of nothing but

{embed=includes/foo}

Takes 5 seconds to change that to

{embed=includes/bar}

So, using myself as ex example. I could have our standard index template. Then, when we are covering E3, we could have our pre-loaded E3 index page go active, and when it is over, change back. Then when it is time for CES, do the same thing, but with our CES template “field”.

So use:

{embed=includes/default}
{embed
=includes/e3}
{embed
=includes/ces}

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 07 July 2008 02:14 PM   [ Ignore ]   [ # 2 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  876
Joined  12-14-2004

Oh, I like it. So basically, instead of coding out the index template, you code out “sub” template, and in the index, just have the embed of the appropriate template that is needed?

 Signature 

Love gadgets, technology, and pop culture? Visit us at Gear Live: http://www.gearlive.com

Profile
 
 
Posted: 07 July 2008 02:25 PM   [ Ignore ]   [ # 3 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15368
Joined  05-15-2004

You could probably define a few more variables, re-use the HTML header or the doctype or whatever, but yes, in general terms that’s it. It’s a technique I have used a couple of times with some success.

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 64917 Total Logged-in Users: 27
Total Topics: 81870 Total Anonymous Users: 17
Total Replies: 440152 Total Guests: 182
Total Posts: 522022    
Members ( View Memberlist )