5 Quickie "How to" Questions!

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

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: [sagentic] 5 Quickie "How to" Questions!

Hello Chaps -

Thanks for your help and advice. I had already considered the bulk of your suggestions which is why I was keen to develop a more inventive solution. I'd rather not hardcode things like page titles if I can avoid it. I've become accustomed to playing around with AM templates and placeholders to the point where I can just drop a template on to the system and it will pretty much fill in all of the blanks automatically. I was rather hoping CMS Builder would allow me to do the same.

[unimpressed]

AJ

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!

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.