5 Quickie "How to" Questions!

8 posts by 3 authors in: Forums > CMS Builder
Last Post: January 26, 2008   (RSS)

By Perchpole - January 25, 2008

Hello, All -

I'm currently enjoying my CMS Builder 10-day free trial and I must say I'm very impressed! I've been a big fan of AM and other interactivetools products for some time and this latest addition to the line-up is up there with the best.

Over the years I've spent many a long evening tinkering with AM template designs. I'm now trying to do the same with CMS Builder. Although (generally) I'm very happy with what I can do there are a couple of fairly simple things that seem to be beyond me! Could someone please explain how I can (use PHP to) do the following:

1) How do I "call" the section name to use as a page <Title> (on both list and viewer pages)?

2) How do I call a record field to use as a page <Title> (on viewer pages)?

3) How would I create a link to take people from a viewer page back to the parent list page?

4) How can I create (forward and back) links to allow people to step - sequentially - from (viewer) page to page?

5) How can I create a list page which list the latest documents from multiple sections?

I probably should add that although I've done a lot of work with AM template creation I have fairly limited experience with (serious) PHP coding. So, apologies in advance if any of the above seem a bit simplistic! I apreciate I can do many of these manually. However, as I have automated many of these functions within AM templates, I am keen to see if I can do the same with CMS Builder.

Thanks

[:)]

AJ

Re: [Perchpole] 5 Quickie "How to" Questions!

By Dave - January 25, 2008

AJ, Welcome aboard! :)

Great questions. I believe all are possible. Some are going to be more complicated that others. We might need to go back and forth a few times to figure it out, but here's my first try.

1) How do I "call" the section name to use as a page <Title> (on both list and viewer pages)?

Because there are only two files (list viewer and page viewer) that display the content for a section, the easiest might just be to hardcode the title into those 2 files.

I could give you some code to load the section name based on the $options['tableName'] but since only admins can update section names I'm not sure if that's what you want. Let me know if you need something more.

2) How do I call a record field to use as a page <Title> (on viewer pages)?

For the "Page Viewer" you just need to move the step1 code block (without the html comments) to the top of the page (above the title) and then you could have:

<title><?php echo $record['title'] ?></title>

3) How would I create a link to take people from a viewer page back to the parent list page?

Once again, this is possible through PHP code, but because there is only 2 viewer pages it's probably simpler to hard code a link. Let me know if you need something more advanced than that.

4) How can I create (forward and back) links to allow people to step - sequentially - from (viewer) page to page?

The easiest way to do this would be to use a "list viewer" instead of a page viewer. Set the perPage value to 1 and put the entire page inside the step 2 foreach block (which would allow you to use the record title as the page title.

The automatic prev/next page links would be displayed and take you from one article to the next.

5) How can I create a list page which list the latest documents from multiple sections?

There's no simple way to do this. You could have multiple list viewers to show the top 3 Jobs, News, Events, etc. Another approach would be to use a single section instead of multiple sections and use fields to indicate different types of records, then have different viewers "filter" all but selected records.

Hope that makes sense! Let me know if I can be more clear or provide additional detail on anything.
Dave Edis - Senior Developer

interactivetools.com

Re: [Dave] 5 Quickie "How to" Questions!

By Kenny - January 25, 2008

On # 3 - just simply insert the following code to link back to your list page:

<FORM>
<INPUT TYPE="button" VALUE="Get Back, Jack!" onClick="history.go(-1)">
</FORM>

Re: [Perchpole] 5 Quickie "How to" Questions!

By Dave - January 25, 2008

It can, and I can give you code for that if you like, I was just starting with the simplest solution. Let me know which ones you want to load and we can figure out the code for it.
Dave Edis - Senior Developer

interactivetools.com

Re: [Dave] 5 Quickie "How to" Questions!

By Dave - January 26, 2008

Further on that. Here's how to load the section title. You need to put this code before the "Step1" block that defines the tablename and loads the library file.

<?php
$schema = loadSchema($options['tableName']);
print $schema['menuName'];
?>


Hope that helps!
Dave Edis - Senior Developer

interactivetools.com

Re: [Dave] 5 Quickie "How to" Questions!

By Perchpole - January 26, 2008

Hi, Dave -



Thanks for the code. This is exactly the type of "snippet" that I like! Contrary to your instructions, however, it only seems to work if placed below Step1.

Otherwise it's great! Thanks.

[:)]

AJ

PS. Any more of these snippets would be most welcome.

Re: [Perchpole] 5 Quickie "How to" Questions!

By Dave - January 26, 2008

That's right, when I say "before" what I mean by that is "below". hehe. Glad you caught that!

>PS. Any more of these snippets would be most welcome.

Just about anything you might want to do is possible. So if you have a specific challenge we can work with that.

Auto linking back and forth between viewers is a little tricky because you can create unlimited viewers and there's no way to tell which is which. When you're on the job page for example you wouldn't want to link back to the viewer that shows the "Top 3 featured jobs" on the home page.

One way to do it would be to use a naming convention where you had jobsList.php and jobsPage.php or /subdir/index.php (which you could call as just /subdir/) and /subdir/detail.php. It you had a set naming convention it would be easy to have a little code that figured out one name from the other.

Another cool thing you can do is define your own section "presets". Once you've created a section, if you copy the file for it from /data/schema/ to /data/schemaPresets/ it will show up in the section add list.

Hope that helps! :)
Dave Edis - Senior Developer

interactivetools.com