Jump to content

Adding gallery system to body copy?


PhotoWebMax
 Share

Recommended Posts

I have a successful template system working for a current site project. This is mainly a photo gallery site where most pages have a title and then the gallery presented with no real text.

On some of the pages I have a text article and a gallery of jQuery powered images. My templates looks something like this:

  • Title
  • Intro image
  • Text article (paragraphs)
  •  jQuery gallery

This work fine for the most part. On some of the pages there is a decent amount of paragraph text. What I would like to do then is present the gallery between two paragraphs higher up instead of at the very end of the text paragraphs each time. I also want the flexibility to decide where the gallery goes. The text paragraphs is simply being output by the echo $page->body field from the CKEditor. 

What is the simplest way of doing this? I am thinking that maybe using HannaCode is the answer here?

Link to comment
Share on other sites

I think hanna code makes the most sense here, but of course if you'd rather avoid that for some reason (maybe no other needs for it on the site, or whatever), you can always do your own replacement.

Have your editors enter [[gallery]] somewhere in the body copy and then in your template do a simple:

echo str_replace("[[gallery]]", $galleryCode, $page->body);

You just need to define $galleryCode in your template code somewhere before the body is output.

  • Like 4
Link to comment
Share on other sites

Thanks guys!

Looks very doable. In this case the site editor will be me. I am also trying to get in the habit of creating quality Field names, labels, descriptions and hint tags in my templates, even if this site will only be edited by me. This helps prevents those "how did I build this?" moments when you come back to a site after time has passed.

I am getting used to using the Hanna Code system, its sort of like the chunks system in MODx....

Edited by PhotoWebMax
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...