SEO URLs Getting Odd Results

6 posts by 2 authors in: Forums > CMS Builder
Last Post: February 25, 2008   (RSS)

By InHouse - February 21, 2008

Hi again,

Situation:
One PHP file with 1 list view showing archive of Topic X and one page view which defaults to showing Record #1 of Topic X with content.

Goals:
1 - Clicking a link from the list view should reload the same page and display the selected article (replacing Record #1).
2 - The default record on the page should be the most recently published Topic X article available (but not one set for a future release date).

Issues:
1 - With $options['useSeoUrls'] = ''; all works normally.
When $options['useSeoUrls'] = '1'; things go weird. The page reloads with the correct article displayed, but all linked CSS files are ignored.

2 - Having trouble getting the most recent article of Topic X to display. Can you please point me in the right direction?

Many, many thanks are anticipated.

Jayme

Re: [InHouse] SEO URLs Getting Odd Results

By Dave - February 21, 2008

For the CSS, check if they're relative links. If you make them absolute urls (starting with "/" or "http://" they should work). The issue is that because the SEO urls have slashes (/) in them it's as if those files are in a subdirectory.

So if you have an url like this:
viewer.php/my_article_title-1/

A css tag like this:
<link href="css/style.css" ... />

Would look for the css here (instead of where it should)
viewer.php/my_article_title-1/css/style.css

Adding "/" or "http://" to the beginning of the css href will fix that.

Hope that makes sense.

>2 - Having trouble getting the most recent article of Topic X to display. Can you please point me in the right direction?

Do you have a sample url where you're trying to do this?

What is the topic field and a value you want to search for?

You can either limit the results of the list viewer by specifying search criteria in the url like this: listViewer.php?topic=sports or by hard coding it in the 'where' option like this: $options['where'] = 'topic = "sports"';

Hoe that helps, let me know if you need more details.
Dave Edis - Senior Developer
interactivetools.com

Re: [InHouse] SEO URLs Getting Odd Results

By Dave - February 22, 2008

Ok, there's probably a few different ways to do it. One way would be as follows:

Have one section for tips. Have a list dropdown field for "category".

Create a seperate page for each category (eg: nutritiontips.php). They'd have almost the same content, but it will be easier to customize page headings and so on.

Have two list viewers on your page. With nutritiontips.php for example, one list viewer would list all the tip links (the menu) and the other the content for the tip.

For the menu list viewer, use these options:

$options['viewerUrl'] = 'nutritiontips.php';
$options['perPage'] = '9999';
$options['pageNum'] = '1';
$options['orderBy'] = 'date DESC';
$options['where'] = 'category = "nutrition"';


The idea is that it will list ALL the tips, sorted by date (newest first - you can sort them however you want), but only list tips in the nutrition category.

And for the content viewer, use these options:

$options['perPage'] = '1';
$options['pageNum'] = '1';
$options['orderBy'] = 'date DESC';
$options['where'] = 'category = "nutrition"';

$num = getNumberFromEndOfUrl();
if ($num) { $options['where'] .= " AND num = '$num'"; }


Where this will list the newest tip from the nutrition category -OR- the tip number specified from the nutrition category.

Would that do everything you need? Let me know if I can provide more details.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] SEO URLs Getting Odd Results

By InHouse - February 22, 2008

So glad to have this validation Dave. Thanks to your help and a few other threads I've done pretty much as you described.

Two variations on a theme:
http://www.cinderblaze.com/mlhu/nutritiontips.php
1 tip at a time with a list of past tips

http://www.cinderblaze.com/mlhu/news.php
Many posts with an anchor list. The next trick there will be to see what happens when we roll to the next page... My problem to solve.

Best wishes,
Jayme

Re: [InHouse] SEO URLs Getting Odd Results

By Dave - February 25, 2008

Looking good, nice work! :)
Dave Edis - Senior Developer
interactivetools.com