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: [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