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: [Perchpole] Section Title as a Link

By Dave - March 11, 2008

Is there an url you could post with html mockups or work in progress to give a better idea of how it's all setup right now?
Dave Edis - Senior Developer
interactivetools.com

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