Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-01-04 18:36:53

guiguibonbon
Member
Registered: 2006-02-20
Posts: 296

Publish.php cleanup

Beside the useless 780 line; there’s also the duplicate ckExID and lookupByID functions. Then we have this thing in getNextPrev :

		// If next/prev tags are placed before an article tag on a list page, we
		// have to guess what the current article is
		if (!$id) {
			$current = safe_row('ID, Posted', 'textpattern',
				'1=1 '.
				(($s!='' && $s!='default') ? "and Section = '".doSlash($s)."'" : filterFrontPage()).
				'and Status = 4 and Posted < now() order by Posted desc limit 1');
			if ($current) {
				$id = $current['ID'];
				$Posted = $current['Posted'];
			}
		}

Which really just looks for the most recent article in the given section. Should it not warn for an error instead? You’re not supposed to use a prev_link or prev_title tag outside an article tag on a list page. This costs three queries (last article, prev article and next article; which can’t exist anyway) and ends up giving an erroneous link.

Also, why is it that the prev and next articles are still being queried for regardless of whether you use the prev and next tags or not?

{Hint} this_article has already been set by pretext(), so you should already have the Posted var.

Last edited by guiguibonbon (2008-01-04 18:48:04)

Offline

#2 2008-01-04 19:31:26

guiguibonbon
Member
Registered: 2006-02-20
Posts: 296

Re: Publish.php cleanup

Oh, also, txp:prev_link and txp:next_link require yet another query to generate the permlink. Rather shameful since we already have posted, id, title and url_title and can inherit section from the callee article.

Offline

Board footer

Powered by FluxBB