NP_LMFancierURL v3.0.2 - Search engine optimized URLs

Post your new plugins here!
User avatar
LordMatt
Posts: 33
Joined: Wed May 01, 2013 7:46 pm

Postby LordMatt » Thu May 23, 2013 5:53 pm

When I ran the SQL from _getCustomBaseURLWithBlogName($blogid, $url) I got encoding errors. I fixed this by running:

Code: Select all

ALTER TABLE  `nucleus_plug_lmfancierurl_custombaseurl` CHANGE  `baseurl`  `baseurl` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL


(Changed the encoding)

Code: Select all

SELECT c.blogid, b.bname as blogname, c.baseurl, c.enablebaseurl, c.defaultblog, c.identifiesblog FROM nucleus_plug_lmfancierurl_custombaseurl c, nucleus_blog b WHERE c.blogid = b.bnumber AND c.baseurl = Left('http://recommend.lordmatt.co.uk/overview-page', Length(c.baseurl)) AND enablebaseurl > 0 ORDER BY b.bname


Now returned zero rows

This clued me into one other issue I could check and I enabled the darn thing in the admin area. Bingo-ringo - it is now working.

Edit: Perversely the subdomains are all working fine now but the domain names are 404...

Edit: I found the part that starts

Code: Select all

if($urlerror)
         {
            header("HTTP/1.0 404 Not Found");

and I added a print_r($this) which shows that it found an item id but it went to error anyway.

Edit: I am still trying to figure out what is happening and added:

Code: Select all

            $test=substr($fullurl, 0, strlen($baseurl));
            echo "
            
            <!--
            [urlerror:{$urlerror}]
            [paramname:{$paramname} == 'blogid' && identifiesblog:{$identifiesblog} && first:{$first}]
            [usedglobalurlscheme:{$usedglobalurlscheme} <> globalurlscheme:{$globalurlscheme}]
            [!aURLPart:{$aURLPart}]
            [usedblogurlscheme:{$usedblogurlscheme} <> blogurlscheme:{$blogurlscheme}]
            [baseurl:{$baseurl} != substr({$fullurl}, 0, strlen({$baseurl})):{$test}]
            [usedhidedefblog:{$usedhidedefblog} <> hidedefblog:{$hidedefblog} && blogid:{$blogid} == defaultblogid:{$defaultblogid}]
            
            
            
            ";
            print_r($this);
            echo "-->";


Which seemed to cover most of the scenarios where an error could be set.

This is the debug values that I got:

[urlerror:1]
[paramname:itemid == 'blogid' && identifiesblog:0 && first:]
[usedglobalurlscheme:compact <> globalurlscheme:fancier]
[!aURLPart:Array]
[usedblogurlscheme: <> blogurlscheme:]
[baseurl:http://hundredquidaday.com != substr(http://hundredquidaday.com/understanding-will-guard-you, 0, strlen(http://hundredquidaday.com)):http://hundredquidaday.com]
[usedhidedefblog:no <> hidedefblog:yes && blogid:2 == defaultblogid:2]


to be honest I'm still a bit clueless as to what the problem is.
User avatar
LordMatt
Posts: 33
Joined: Wed May 01, 2013 7:46 pm

Postby LordMatt » Thu May 23, 2013 6:48 pm

Solution (of a sort)

I went through the function in question and added a few extra lines of code to report an error code as well as an error flag.

example:

Code: Select all

         if($usedglobalurlscheme <> $globalurlscheme)
         {
            $urlerror = true;$urlerrorcode = 7;
         }

         if($bloglevelurl && $blogid)
         {
            
            if(!$usedblogurlscheme)
            {
               $usedblogurlscheme = 'compact';
            }

            $blogurlscheme = $this->_getBlogURLScheme($blogid);

            if($usedblogurlscheme <> $blogurlscheme)
            {
               $urlerror = true;$urlerrorcode = 8;
            }
         }
         
         if($usedhidedefblog <> $hidedefblog && $blogid == $defaultblogid)
         {
            $urlerror = true;$urlerrorcode = 9;
         }


I've not chosen that example at random. If I comment out the lines with 7 and 9 in then everything works well.

Aside: Can I talk you into using GitHub to host your code? I'd love to be able to contribute more directly.
User avatar
slightlysome
Posts: 213
Joined: Thu Feb 24, 2011 1:33 am
Contact:

Postby slightlysome » Sat May 25, 2013 2:12 am

LordMatt wrote:I use a switcher to pick the right details and have a handful of different domains working fine.

You don't not need to use your switching technique if you use the Custom Base URL feature in FancierURL. And the www prefix handling should be a .htaccess redirect, otherwise it will mess up the Custom Base URL handling.

LordMatt wrote:When I ran the SQL from _getCustomBaseURLWithBlogName($blogid, $url) I got encoding errors.

I don't understand why you get encoding errors here, as the baseurl field should only contain 7bit characters.

LordMatt wrote: [urlerror:1]
[paramname:itemid == 'blogid' && identifiesblog:0 && first:]
[usedglobalurlscheme:compact <> globalurlscheme:fancier]
[!aURLPart:Array]
[usedblogurlscheme: <> blogurlscheme:]
[baseurl:http://hundredquidaday.com != substr(http://hundredquidaday.com/understanding-will-guard-you, 0, strlen(http://hundredquidaday.com)):http://hundredquidaday.com]
[usedhidedefblog:no <> hidedefblog:yes && blogid:2 == defaultblogid:2]

These values are strange. The $blogid variable you set in your switcher seems to mess up the logic in the url parsing.

LordMatt wrote:Aside: Can I talk you into using GitHub to host your code? I'd love to be able to contribute more directly.

I already have the code for my plugins in local git-repositories with trac on top, so I don't need the github functionality. These plugins are rather small and personal projects, so I don't think the work involved in changing my development environment will outweigh the cooperation options.
- Leo -
LMNucleus CMS home page: nucleus.slightlysome.net
My Nucleus powered blogs: www.slightlysome.net - www.tswtraveler.com
My Nucleus plugins.
User avatar
slightlysome
Posts: 213
Joined: Thu Feb 24, 2011 1:33 am
Contact:

Postby slightlysome » Sat Feb 15, 2014 6:27 pm

The v3.0.2 version of the NP_LMFancierURL plugin has been released. The changes for this version are:
  • Support for the NP_TechnoratiTags plugin.
For a download link, upgrade documentation and the full information on the plugin see the NP_LMFancierURL plugin page.
- Leo -

LMNucleus CMS home page: nucleus.slightlysome.net

My Nucleus powered blogs: www.slightlysome.net - www.tswtraveler.com

My Nucleus plugins.

Return to “Plugin Development”