Problems, need help? Have a tip or advice? Post it here.
4 posts Page 1 of 1
Is it possible to change the name of the template been used for menu_maker / nested_pages, currently I am using index.php, however my home page requires it's own template because it has lots of different editable regions (slideshows, latest news feed etc).

I want to rename index.php (current nested pages to build out site structure / pages) to pages.php so I can then use index.php as the homepage (because hitting mysite.com will load index.php as the default page) - If I do this will I loose the page structures I have already built out and the content in those pages, as well as the dynamic folders?
Changing the name of an existing template can only be done by directly manipulating the database. The process is simple, though. Use phpMyAdmin to find the 'couch_templates' table. Each template will have a single record in this table. Find the record of your template and modify the 'name' field to put in the new name.
Make sure to rename the physical template file also.

That said, I think there is another solution to your problem.
I think you can leave the structure as is and, instead, use another uncloned template only for the home page (e.g. named home.php). Define as many editable regions as you wish in it.
Now make the 'home-view' of index.php masquerade the template we created above.

This can be done the following way (in index.php):
Code: Select all
<cms:is_home>
   <cms:masquerade "<cms:link 'home.php' />" />
<cms:else/>
   .. the existing logic ..
</cms:if>

The 'masquerade' tag is the key here.
Does this help? Please let me know.
Thanks.
Hi KK,

Went with he renaming options, to me it's just a bit neater in the template folder, plus I prefer to think of pages as been built out with pages.php, that's just my preference.

I just hd to update a few references to index.php so my menu would work and the "service" blocks would pull in, no biggie because I have my templates broken into nice "chunks" in the snippets folder.

Just out of interest, is there a way of outputting the load / query execution times, I'd be interested to see if there is a lot of load if I were to embed lot's snippets.
is there a way of outputting the load / query execution times

None as yet, I'm afraid.
I'd be interested to see if there is a lot of load if I were to embed lot's snippets.

As far as Couch's parser is concerned, an embedded snippet is the same as having the code within the snippet pasted in its place. So, nothing to worry about here.

However, since each embedded snippet is a discrete file on the disk, each embed statement would mean a file access. This might possibly affect the performance, though I am sure the OS caches all these accesses and knows better how to optimize things. In any case, I don't think you'll have hundreds of embed statements, or will you?

Finally, I'd say simply use caching and forget all performance issues :)
4 posts Page 1 of 1