Section Title as a Link

5 posts by 2 authors in: Forums > CMS Builder
Last Post: March 11, 2008   (RSS)

By Perchpole - March 11, 2008

Hello All (and Dave!)

I'm trying to work out how to pull the data from the database that will allow me create a link to the parent list page of a section.

Dave very kindly provided me with this code in an earlier post:

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


This creates the section title. What I need to do now is wrap this in an HREF tag so that it links to the relevant section list page, i.e.:

<a href="XYZ"><?php $schema = loadSchema($options['tableName']); print $schema['menuName']; ?></a>


I've tried lots of different code combinations but I just can't work it out!

Any advice would be most welcome

[unimpressed]

AJ

Re: [Perchpole] Section Title as a Link

By Dave - March 11, 2008

Are you trying to create a menu or just be able to link from the detail page back to the record list?

The url to your list page isn't stored anywhere, but there's a few ways to do this. Here's some:

- The simplest being the javascript:history.back(1)

- If you follow a naming convention and always have your list pages named /somedir/index.php and your detail pages named something in that directory you could have your link to "./" to go to the directory root. So you'd have /jobs/ (the index) and /jobs/detail.php?3 which would link back to the index.

- Another way is to create a whole new section for you menu or links. I'll often create a single page section called "Misc Content" with little text snippets used on the site. I'll load it on every page (into $misc instead of $record) and then link to content like this: <?php echo $miscContent['jobIndexLink']; ?>

Would any of those help? Or do we need something else?
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Section Title as a Link

By Perchpole - March 11, 2008


Hi, Dave -

Thanks for your response. As with other posts, I'm trying to find the simplest way to put together a series of templates which use generic code to populate the links and references to other pages. You can do this in AM but it seems a bit harder CMS.

One of the sites I'm building has a lot of different categories. I've configured a range of list pages for each category (designed to display the same data in different ways) which are called-up at various points around the site. Some (cut down) lists appear in the margins of other list pages (via php includes). In all cases it would be nice to use a generic link on each list to allow visitors to jump back to the index page at the top of the category.

Again, I'd like to do this with code drawn from the database. The only alternative is that I will have to edit the link for each template - which (IMHO) defeats the purpose of this software!

I appreciate I could use something along the lines of:

./category_folder/index.php


...but how would I call the "category_folder" - without adding it manually to every template?

:)

AJ

Re: [Dave] Section Title as a Link

By Perchpole - March 11, 2008

Hi, Dave -

Yes, take a look here...

http://www.mms-models.co.uk/

This particular problem concerns the lists in the right-hand margin. As you'll see, each sub list shows the last 3 products (added to each category). Directly above each list is the category name. I would like to use these titles (Classic Series, Accessory Pak) to link back to that specific category.

Yes, I could hard-code the links but it defeats the object! Besides a working example of how this could be achieved would be useful for other instances around this and other sites.

:)

AJ