Search Friendly URLs

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

When I use $options['useSeoUrls'] = '1'; it returns http://products.php/1/ which is a broken link instead of http://www.mellinger-co.com/products.php?1/ that the $options['useSeoUrls'] = ''; produces. What am I doing wrong please. Also AM produces SE friendly URLs like http://www.tradezone.com/articles/global-business/Ten_Tips_for_Translating_Your_Business_Card_16.php. for each page your create. CMS produces products.php?1/2/3 etc which definitely is not what I am looking for. The client should be able to name each page in a section the way he wants it to appear. Of course I may be missing something here since I am just learning the program.[/#333366] [/#333366] Also, can I call from separate tables on one page? $options['tableName'] = 'products'; calls from products table, how would I add the ability to call from a second table to use the fields in that table also on the same page?[/#333366] [/#333366] Thanks you for your time and efforts.[/#333366]

Re: [Glasairmell] Search Friendly URLs

By Dave - February 8, 2008

Hi Glasairmell,

Let's see if I can answer all those questions, let me know if I miss one or if I can provide more detail.

>Broken links with useSeoUrls

I think this is the same as a glitch I found last night. When your viewer is in the root of the website it puts two slashes in front of the url and the browser links to it like this: http://products.php which of course doesn't work. It's fixed for the next version, here's the fix if you want to apply it yourself.

Open lib/viewer_functions.php search for "get absolute url" and replace this:

// get absolute url for viewer
if (@$options['useSeoUrls'] && @$options['viewerUrl'] && !preg_match("|[/]|", $options['viewerUrl'])) {
$options['viewerUrl'] = dirname($_SERVER['PHP_SELF']) ."/". $options['viewerUrl'];
}


with this:

// get absolute url for viewer
if (@$options['useSeoUrls'] && @$options['viewerUrl'] && !preg_match("|[/]|", $options['viewerUrl'])) {
$options['viewerUrl'] = dirname($_SERVER['PHP_SELF']) ."/". $options['viewerUrl'];
$options['viewerUrl'] = preg_replace("/\\/+/", "/", $options['viewerUrl']); // remove multiple leading /'s
}


>How can the client specify the url names?

The viewer option 'titleField' specifies a list of fields to check when creating the url. So if you create a text field called 'filename' and set 'titleField' to be "filename,title" it would use the value from the filename field unless it's blank, then it would use the value from the title field.

>Can I call from separate tables on one page?

Yes, you can have as many viewers as you need in one page. Just copy and paste multiple viewers into a page and give it a try. If the variables are overwriting each other or getting confusing you can rename them. For example you can replace all instances of $listRows with $articleRows. Or you might rename $record to be $article.

Hope that helps. Let me know if I can provide any more details.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Search Friendly URLs

Thank you, that fixed it.

I am not sure why you formated your seo urls to section.php/name-1/

To me this looks much better for SEO. section.php/name.html
however that is just little ole me talking.

Why not make it look like this using the $options['titleField'] = 'name'; function?
http://www.mellinger-co.com/products.php/Garden_Shears.html

instead of like you do it. http://www.mellinger-co.com/products.php/Garden_Shears-1/

In the viewer_functions.php file
// Mod here took away the "-"
if ($extraUrlDetails) { $extraUrlDetails .= ""; }

and changed this line
$record['_link'] = $options['viewerUrl'] . $urlDelimiter . $extraUrlDetails . ".html";

Not sure yet if I created in trouble for myself by doing that but it looks nice to me = ) Yes it is nice that you can do things the way you want with your program and thank you for that. Your forum response is excellent and you have always provided great service for Article Manager which I love dearly.