Inter-FAQ Links broken

Please report bugs here!

Moderator: Thorsten

Post Reply
jenolan
Posts: 16
Joined: Fri Apr 13, 2007 12:54 pm

Inter-FAQ Links broken

Post by jenolan »

On our FAQ page like

Code: Select all

http://www.razorbackrailway.com/apps/faq/index.php?action=artikel&cat=8&id=8&artlang=en
Look at the link for 'Trainz Objectz' it shows as

Code: Select all

http://www.razorbackrailway.com/apps/faq/index.phpw.razorbackrailway.com/apps/faq/index.php?action=artikel&cat=5&id=126&artlang=en
but in the db it is

Code: Select all

http://www.razorbackrailway.com/apps/faq/index.php?action=artikel&cat=5&id=126&artlang=en
which is correct something is fiddling the url could you please fix.

Thanks,
Larry
Thorsten
Posts: 15724
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

strange... I'll take a look at it.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
jenolan
Posts: 16
Joined: Fri Apr 13, 2007 12:54 pm

Post by jenolan »

Found the problem in artikel.php line 123 change the following url mangler as follows....

Code: Select all

// Search for href attributes only

if (isset($oLnk->urlpool['href'])) {
    $linkArray = array_unique($oLnk->urlpool['href']);
    foreach ($linkArray as $_url) 
	{
        $xpos = strpos( $_url, 'index.php?action=artikel' ); 
        if ( !( $xpos === false ) ) 
		{
            // Get the Faq link title
            preg_match('/id=([\d]+)/ism', $_url, $matches);
            $_id   = $matches[1];
            preg_match('/artlang=([a-z\-]+)$/ism', $_url, $matches);
            $_lang = $matches[1];
            $_title = $faq->getRecordTitle($_id, false);
            $_link = substr($_url, $xpos + 9);
            // Move the link to XHTML
            if (strpos($_url, '&') === false) {
                $_link = str_replace('&', '&', $_link);
            }
            $oLink = new PMF_Link(PMF_Link::getSystemRelativeUri().$_link);
            $oLink->itemTitle = $_title;
            $oLink->tooltip = PMF_htmlentities($_title, ENT_QUOTES, $PMF_LANG['metaCharset']);
            $newFaqPath = $oLink->toString();
            $fixedContent = str_replace($_url, $newFaqPath, $fixedContent);
        }
    }
}

$content = $fixedContent;
The code is assuming no leading http information.

Larry
Post Reply