Ingmar: I’m not sure I understand what you mean? Are you saying that even without the extension you would need to build 200+ templates.
sigork: The module does support nested categories. You just have to set them up under the Admin » Weblog Admin » Categories tab. (What version of EE are you using?)
No, of course not. Whenever I have to handle static pages, I build a “static” weblog, and a “static” template. Then I use something like www.example.com/index.php/site/static/about_us, where “About us” is an entry in a weblog. Makes sense? Pretty standard procedure, really.
Here’s an update for you! The extension now interacts with the template system. To do this go into the pages module and choose to configure the module. There you will see two lists, one to choose a weblog (as defined in my previous tutorial) and the other to choose a static template. This template will be used whenever a user navigates to a static page.
Static pages are defined by the category structure associated with the weblog you choose. They are generated by the category name, so let’s take the following structure and see how this works:
About
-- Staff
---- We’re Hiring
---- Submit Your Resume
-- Directions
News
Legal
-- Privacy Polity
-- Terms and Conditions
Normally (assuming you haven’t made a template called “about” in your site) navigating to /about would bring you to a 404 or the site homepage. Now with my module/extension navigating to /about will bring you to the static template you defined. Likewise, navigating to /about/staff/submit_your_resume will bring you to the static template you defined. You’ll notice the url structure is created by converting spaces to underscores and the entire string to lowercase.
Finally, on the static page template you have access to three new global variables:
1. {static_page} which returns the category of the page you are viewing, helpful for {exp:weblog:entries category="{static_page}"}
2. {static_page_name} which returns the category name you are viewing
3. {static_page_short_name} which returns the url of the static page you are viewing (so something like submit_your_resume).
I’ll be writing another tutorial on this soon, but hopefully this will help out in the meantime.
Well, my example was the base way of doing it. You can, of course, remove both the template group as well as the template, using the default values, so URLs like
www.example.com/about_us
are easily possible. Having said that, I’ll give the extenskion a whirl.
okay, i’m stuck. Installed, had some sort of weirdness, now can’t remove and can’t reinstall. Getting the following error when i try either to remove or to go to the module page:
Alright, another update for everyone. This one adds a setting to the extension which allows you to set wether the extension should override existing templates, because before it would no matter what. Enjoy and grab it at the top of this thread, it should be version 2.0.0, or 200.
Ahh, we’ll you’re one post ahead of me. I’m planning on offering configurable (per category) templates in the module, it won’t be in the url, but you will be able to set exactly which template each category uses.
Is there a reason you requested this ability specifically in the url? Currently one method you could use is on the static page template, place a few conditionals that basically display different pages based on the {segment_x} variables?
Well, in the URL because occasionally i’d want to use the SAME info ("Contact Us”, for instance) with several DIFFERENT templates. I run about 6 different personal projects with my one EE installation, and obviously my contact info doesn’t change between them all!
I *could* do it all in one template, but WOW that would be a lot of conditionals. Include this header, this footer, this set of body tags, etc....
Certainly being able to configure per category would be great, though, and would solve easily 95% of my problems—just not the other 5%. So, solve those, and i’ll deal with the conditionals.
alright alienne, check it out now. I’ve added per-page template choices. You can find it at the bottom of the configure tab. As always get the latest update at the top of this thread.