Sharing Content between Pages

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
rich4647
Regular
Posts: 7
Joined: Tue Apr 22, 2008 11:47 pm

Sharing Content between Pages

Post 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
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Sharing Content between Pages

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply