Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-09-19 01:25:16

jsanto
Member
From: New York, NY
Registered: 2005-07-30
Posts: 19
Website

bad section links with clean URLs (yes I read the FAQ - please read!)

yes i read this:

http://textpattern.com/faq/66/404-error-when-linking-to-article-pages

but my problem is a little different, i think.

let’s say i’ve set my permalink mode to /section/title

on the home page, one can see:

  • a list of sections (using mdp_sectionmenu) that have links in the form of /sectionname
  • a list of categories (using category_list) that have links in the form of /category/categoryname
  • articles, whose titles have links in the form of /sectionname/title

all of these links work great from the home page. i can get to indexes for each of the sections and categories and i can get to the article body. i can also get to the article body from section or category indexes. no problem there. clean URLs working just fine.

the problem is, when i am viewing the article body, the section links change to:

/section-of-the-article-i-am-reading/section-i-want-to-visit

for example, if the article i am viewing is in the News section and i want to get to the Help section, i can’t, because the Help section link has become:

/news/help

instead of:

/help

a similar problem occurs on a category index page. instead of /help, the same link would be:

/category/articles/help

clicking on that does not bring me to the section index. i just stay on the category index.

so you see (i hope), that my issue is not that the host does not support clean URLs — it does — but rather this weird pathing problem that produces URLs that don’t work.

what’s driving me crazy is that i have another textpattern install on another domain with the same host (AQHost), that is set up in pretty much the same way, and this problem does not exist!

here’s my .htaccess if that will help:

RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html

RewriteBase /
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+) – [PT,L]

RewriteRule ^(.*) /index.php

Offline

#2 2006-09-19 02:14:50

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: bad section links with clean URLs (yes I read the FAQ - please read!)

Offline

#3 2006-09-19 02:35:51

jsanto
Member
From: New York, NY
Registered: 2005-07-30
Posts: 19
Website

Re: bad section links with clean URLs (yes I read the FAQ - please read!)

thanks mary. this tag trace is taken from an article body:

<!-- txp tag trace: 
[SQL (0.000078): select name from `txp_lang` where lang='en-us' limit 1]
[SQL (0.000750): select name, data from `txp_lang` where lang='en-us' AND ( event='public' OR event='common')]
[SQL (0.000369): select name, code from `txp_plugin` where status='1']
[SQL (0.000864): select ID,Section from `textpattern` where url_title like 'the-story-of-new-good-cop-web-site' AND Section='good-cop-news' limit 1]
[SQL (0.000329): select * from `txp_section` where name = 'good-cop-news' limit 1]
[SQL (0.000234): select Posted, AuthorID, Keywords from `textpattern` where ID=60]
[SQL (0.000643): select ID, Title, url_title, unix_timestamp(Posted) as uposted
			from textpattern where Posted > '2006-09-15 17:36:00' and Section = 'good-cop-news' and Status=4 and Posted < now() order by Posted asc limit 1]
[SQL (0.001204): select ID, Title, url_title, unix_timestamp(Posted) as uposted
			from textpattern where Posted < '2006-09-15 17:36:00' and Section = 'good-cop-news' and Status=4 and Posted < now() order by Posted desc limit 1]
[SQL (0.000140): select RealName from `txp_users` where `name` = 'goodcop' limit 1]
[SQL (0.000233): select host from `txp_log` where ip='207.38.213.68' limit 1]
[SQL (0.000220): insert into `txp_log` set `time`=now(),page='/good-cop-news/the-story-of-new-good-cop-web-site',ip='207.38.213.68',host='207-38-213-68.c3-0.elm-ubr3.qens-elm.ny.cable.rcn.com',refer='',status='200',method='GET']
[SQL (0.000139): select user_html from `txp_page` where name='static']
[Page: static]
<txp:css/>
<txp:page_title/>
	[SQL (0.000230): select Title from `textpattern` where ID = 60]
<txp:output_form form="siteHeader" />
	[SQL (0.000073): select form from `txp_form` where `name` = 'siteHeader' limit 1]
<txp:output_form form="sidebar-1" />
	[SQL (0.000068): select form from `txp_form` where `name` = 'sidebar-1' limit 1]
	<txp:output_form form="sectionNav" />
		[SQL (0.000068): select form from `txp_form` where `name` = 'sectionNav' limit 1]
		<txp:mdp_sectionmenu noshow="about,contact,images,news,past-clients,two-loons-for-tea,good-cop-news" home="0" class="menuItem" />
			[SQL (0.000132): select name from `txp_section` where name != 'default' order by name]
			[SQL (0.000067): select title from `txp_section` where `name` = 'about' limit 1]
			[SQL (0.000067): select title from `txp_section` where `name` = 'arnau-jennie' limit 1]
			[SQL (0.000066): select title from `txp_section` where `name` = 'bartell-shane' limit 1]
			[SQL (0.000067): select title from `txp_section` where `name` = 'birdmonster' limit 1]
			[SQL (0.000066): select title from `txp_section` where `name` = 'brown-jule' limit 1]
			[SQL (0.000067): select title from `txp_section` where `name` = 'burden-brothers' limit 1]
			[SQL (0.000074): select title from `txp_section` where `name` = 'churchills-the' limit 1]
			[SQL (0.000068): select title from `txp_section` where `name` = 'contact' limit 1]
			[SQL (0.000061): select title from `txp_section` where `name` = 'dempsey-damien' limit 1]
			[SQL (0.000060): select title from `txp_section` where `name` = 'divine-comedy' limit 1]
			[SQL (0.000062): select title from `txp_section` where `name` = 'enter-the-haggis' limit 1]
			[SQL (0.000061): select title from `txp_section` where `name` = 'glanville-justin' limit 1]
			[SQL (0.000061): select title from `txp_section` where `name` = 'good-cop-news' limit 1]
			[SQL (0.000061): select title from `txp_section` where `name` = 'guggenheim-grotto' limit 1]
			[SQL (0.000060): select title from `txp_section` where `name` = 'hot-one' limit 1]
			[SQL (0.000060): select title from `txp_section` where `name` = 'hourly-radio' limit 1]
			[SQL (0.000060): select title from `txp_section` where `name` = 'images' limit 1]
			[SQL (0.000060): select title from `txp_section` where `name` = 'in-flight-radio' limit 1]
			[SQL (0.000060): select title from `txp_section` where `name` = 'keating-matt' limit 1]
			[SQL (0.000060): select title from `txp_section` where `name` = 'kunek' limit 1]
			[SQL (0.000060): select title from `txp_section` where `name` = 'lewis-jeffrey' limit 1]
			[SQL (0.000060): select title from `txp_section` where `name` = 'mcadam-mark' limit 1]
			[SQL (0.000060): select title from `txp_section` where `name` = 'oppenheimer' limit 1]
			[SQL (0.000060): select title from `txp_section` where `name` = 'past-clients' limit 1]
			[SQL (0.000060): select title from `txp_section` where `name` = 'slip-the' limit 1]
			[SQL (0.000102): select title from `txp_section` where `name` = 'two-loons-for-tea' limit 1]
			[SQL (0.000078): select title from `txp_section` where `name` = 'village-green' limit 1]
<txp:article form="article" />
	[SQL (0.000400): select *, unix_timestamp(Posted) as uPosted from `textpattern` where ID='60' and Status in (4,5) limit 1]
	[article 60]
	[SQL (0.000194): select Form from `txp_form` where `name` = 'article' limit 1]
	[Form: article]
	<txp:title/>
	<txp:body/>
<txp:output_form form="sidebar-2" />
	[SQL (0.000067): select form from `txp_form` where `name` = 'sidebar-2' limit 1]
	<txp:output_form form="aboutNav" />
		[SQL (0.000061): select form from `txp_form` where `name` = 'aboutNav' limit 1]
		<txp:mdp_sectionmenu order="about,contact,past-clients" home="0" class="navItem" />
			[SQL (0.000121): select name from `txp_section` where name != 'default' order by name]
			[SQL (0.000062): select title from `txp_section` where `name` = 'about' limit 1]
			[SQL (0.000061): select title from `txp_section` where `name` = 'contact' limit 1]
			[SQL (0.000060): select title from `txp_section` where `name` = 'past-clients' limit 1]
	<txp:category_list wraptag="ul" break="li" />
		[SQL (0.000079): select name,title from `txp_category` where name != 'default' and type='article' order by name]
<txp:output_form form="frontPageNewStuff" />
	[SQL (0.000067): select form from `txp_form` where `name` = 'frontPageNewStuff' limit 1]
	<txp:output_form form="newImagesThumb" />
		[SQL (0.000061): select form from `txp_form` where `name` = 'newImagesThumb' limit 1]
		<txp:dru_random_image category="new-images" />
			[SQL (0.000296): select id from txp_image where category like 'new-images' order by rand() limit 1]
			[SQL (0.000093): select * from `txp_image` where id='60' limit 1]
	<txp:file_download_list form="frontPageFiles" limit="4" />
		[SQL (0.000086): select * from `txp_file` where 1 order by filename limit 0, 4]
		[SQL (0.000075): select * from `txp_file` where id='17']
		[SQL (0.000076): select * from `txp_file` where id='17']
		[SQL (0.000063): select Form from `txp_form` where `name` = 'frontPageFiles' limit 1]
		[Form: frontPageFiles]
		<txp:file_download_link>
			<txp:file_download_description/>
		</txp:file_download_link>
		<txp:file_download_category/>
		<txp:file_download_size format="auto" decimals="1" />
		<txp:file_download_created format="%D" />
		[SQL (0.000079): select * from `txp_file` where id='27']
		[SQL (0.000075): select * from `txp_file` where id='27']
		[Form: frontPageFiles]
		<txp:file_download_link>
			<txp:file_download_description/>
		</txp:file_download_link>
		<txp:file_download_category/>
		<txp:file_download_size format="auto" decimals="1" />
		<txp:file_download_created format="%D" />
		[SQL (0.000104): select * from `txp_file` where id='28']
		[SQL (0.000078): select * from `txp_file` where id='28']
		[Form: frontPageFiles]
		<txp:file_download_link>
			<txp:file_download_description/>
		</txp:file_download_link>
		<txp:file_download_category/>
		<txp:file_download_size format="auto" decimals="1" />
		<txp:file_download_created format="%D" />
		[SQL (0.000080): select * from `txp_file` where id='40']
		[SQL (0.000077): select * from `txp_file` where id='40']
		[Form: frontPageFiles]
		<txp:file_download_link>
			<txp:file_download_description/>
		</txp:file_download_link>
		<txp:file_download_category/>
		<txp:file_download_size format="auto" decimals="1" />
		<txp:file_download_created format="%D" />
	<txp:article_custom category="tour-dates" form="frontPageTourDates" limit="4" />
		[SQL (0.001599): select *, unix_timestamp(Posted) as uPosted from `textpattern` where 1 and Status='4' and Posted < now() and ((Category1='tour-dates') or (Category2='tour-dates'))  order by Posted desc limit 0, 4]
		[SQL (0.000081): select Form from `txp_form` where `name` = 'frontPageTourDates' limit 1]
		[Form: frontPageTourDates]
		[article 59]
		<txp:permlink>
			<txp:title/>
		</txp:permlink>
		[article 55]
		<txp:permlink>
			<txp:title/>
		</txp:permlink>
		[article 36]
		<txp:permlink>
			<txp:title/>
		</txp:permlink>
		[article 35]
		<txp:permlink>
			<txp:title/>
		</txp:permlink>
[ --- secondpass --- ]
 -->

Last edited by zem (2006-09-19 03:30:09)

Offline

#4 2006-09-19 03:31:32

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: bad section links with clean URLs (yes I read the FAQ - please read!)

  • It looks like you’re experiencing a problem with the mdp_sectionmenu plugin. Can you confirm this is the source of the problem? If so, I’ll move this thread to the plugins forum.
  • Are you sure that your site url, as set in admin prefs, is correct?

Offline

#5 2006-09-19 03:33:29

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: bad section links with clean URLs (yes I read the FAQ - please read!)

Assuming the section links are generated by the mdb_sectionmenu plugin, it’s probably a bug caused by relative links.


Alex

Offline

#6 2006-09-19 03:51:45

jsanto
Member
From: New York, NY
Registered: 2005-07-30
Posts: 19
Website

Re: bad section links with clean URLs (yes I read the FAQ - please read!)

zem wrote:

Assuming the section links are generated by the mdb_sectionmenu plugin, it’s probably a bug caused by relative links.

sweet! that was it. adding base href to all the pages corrected for a bug in the plugin. thanks very much!

but base href is not the best solution, imo.

see my reply to mary for correction to the plugin — thanks again!

Offline

#7 2006-09-19 04:07:17

jsanto
Member
From: New York, NY
Registered: 2005-07-30
Posts: 19
Website

Re: bad section links with clean URLs (yes I read the FAQ - please read!)

Mary wrote:

  • It looks like you’re experiencing a problem with the mdp_sectionmenu plugin. Can you confirm this is the source of the problem? If so, I’ll move this thread to the plugins forum.

you are correct, it was the plugin and zem’s reply pointed the way to a solution.

i checked and discovered that the site without the problem has v0.3 of mdp_sectionmenu installed, whereas the problem site has v0.5 installed.

here’s the difference:

0.3 -

if($permlink_mode 'section_id_title' or $permlink_mode ‘section_title’) {
$tagatts[] = ($sect == ‘default’) ? ‘ href=”/”’ : ‘ href=”/’.$sect.’”’;

0.5 -

if($permlink_mode 'section_id_title' or $permlink_mode ‘section_title’) {
$tagatts[] = ($sect == ‘default’) ? ‘ href=”/”’ : ‘ href=”’.$sect.’”’;

note the missing backslash in v.05:

href=”/’.$sect.’”’;

added that and voila! problem solved. base href would also overcome the bug, as zem suggested but i prefer not to go that route.

although problem is solved, i agree this thread should be moved to the plugins forum, so that others can learn from my experience. i’ll also pass this along to the plugin author.

thanks mary — and zem — for this quick resolution. you guys are the best!

Offline

#8 2006-09-20 02:44:06

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: bad section links with clean URLs (yes I read the FAQ - please read!)

The fix is for the plugin to make use of the hu constant and the pagelinkurl() function.

i.e.:

if ($sec == 'default')
{
	$tagatts[] = ' href="'.hu.'"';
}

else
{
	$tagatts[] = ' href="'.pagelinkurl(array('section' => $sect)).'"';
}

:)

Offline

Board footer

Powered by FluxBB