Page 1 of 1

Sharing Content between Pages

Posted: Mon Apr 28, 2008 12:55 pm
by rich4647
Hello Again All,


Here's my situation:

I have a set of static pages (using the static pages plugin). This set of pages are for things like a FAQ and Contact Us page. The FAQ is actually quite large and is divided up into several sub-pages.


Some of these sub-pages have content which is duplicated on other sub-pages. Is there any way for me to have different pages pull content from a single repository so that if I change a paragraph in one spot, that same paragraph will change in all the other pages? Thus eliminating my need to remember which other spots this text is found in.

This project is very much just starting so if I need to use something other than Static Pages, that is fine.

Thanks so much for any assistance.
- Rich

Re: Sharing Content between Pages

Posted: Mon Apr 28, 2008 1:07 pm
by garvinhicking
Hi!

Actually, you can do something like that. There are even two options for that:

1.
Serendipity has a plugin called serendipity_event_includeentry ("Markup: Include entry data/templates/blocks") that you can use to embed so called "Template blocks" that you can define just like entries. You can then use markup like this in the content of your staticpage:

Code: Select all

[s9y-include-block:17]
which would include the contents of block #17, that you created using the plugin's admin interface.

2.
The more versatile way would be to install the serendipity_event_smartymarkup event plugin, which exposes the full set of Smarty templating to static page bodies. Then you could create your texts inside your template directory within simple files like "templates/default/faq-1.htm", and then include them by typing this into your s9y static pages:

Code: Select all

{include file="faq-1.htm"}
You could also create custom smarty modifiers or functions (register them in the config.inc.php file of your template) so that you can call up any function you'd like, even include the texts from the database instead of the filesystem.

Hope that gets you started,
Garvin