Add page template suggestion
sime - February 28, 2008 - 01:52
| Project: | Sections |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
Hey, thought I'd just drop this idea in the bucket - looking for feedback. On our latest job we were very close to coding something like this.
panels_pages uses hook_menu to override the page callback. It would be cool to do this with sections too. Add the logic into hook_menu, define our sections_page callback, load the panel, push the content into the one of the panes, render the page.
We could also do this as a separate contributed module, but we'd need to get this patch applied so that we can ask what the current section is.

#1
Do you like to switch to different page.tpl.php files for different sections? Something like
page-sections-[section-number].tpl.phporpage-sections-[section-name].tpl.php?#2
See http://drupal.org/node/223440
#3
I created a patch that allows page template suggestions per sections name and sections id. So the suggested page.tpl.php filename becomes
sections-page-[sid].tpl.phpsections-page-[name].tpl.phpSpecial chars get replaced with a hyphen. for e.g. a section name like "tesöt" (German Sonderzeichen) results in a suggestion file
sections-page-tes-t.tpl.phpI like this very much and i think it will solve your feature request...
#4
I like this.
Can someone test and review it?
#5
Hi hass, I'm glad to see you've found a valid use-case for being about to load the name/sid of the current section. We have many other examples that are relevant to how we develop websites.
I hope at least the SQL change gets into Drupal 5 version so we don't have to maintain a fork of sections any more. If you make a similar patch for D5 I will test it.
#6
Template suggestion and preprocess_page is new in D6. I have no good idea how we could backport this... do you have an idea?
If you share your examples it would be helpful to see if we are missing something important.
#7
I'm only interested in backporting the SQL query line. (ie. this patch). Your previous argument against it was that there isn't a valid use-case for this.
In fact you've previously said that loading and using sid/name is bad practice! :)
You've modified D6 version to allow yourself to do this cool theme thing, I'd be grateful if you'd modify the D5 version too so that we can do other cool things, thus expanding your (developer) user base without doing anything major.
Thanks
#8
#9
Automatically closed -- issue fixed for two weeks with no activity.