We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

photo plugin & sign issue | Forum

dave Leader
dave Oct 11 '13

inside of ow_plugins/photo/init.php  you have this function

 

function photo_hash_redirect()
{
    $script = 'var lochash = document.location.hash.substr(1);
    if ( lochash )
    {
        var photo_id = lochash.substr(lochash.indexOf("view-photo=")).split("&")[0].split("=")[1];
        if ( photo_id )
        {
            document.location = '.json_encode(OW::getRouter()->urlForRoute('view_photo', array('id' => ''))).' + photo_id;
        }
    }';

    OW::getDocument()->addScriptDeclarationBeforeIncludes($script);
}

 

 

 

which causes this issue

 

character "&" is the first character of a delimiter but occurred as data

 

which can be corrected by wrapping it in  and open and close cdata like so

 

function photo_hash_redirect()
{
    $script = '//<![CDATA[
              var lochash = document.location.hash.substr(1);
    if ( lochash )
    {
        var photo_id = lochash.substr(lochash.indexOf("view-photo=")).split("&")[0].split("=")[1];
        if ( photo_id )
        {
            document.location = '.json_encode(OW::getRouter()->urlForRoute('view_photo', array('id' => ''))).' + photo_id;
        }
    }
       //]]>';

    OW::getDocument()->addScriptDeclarationBeforeIncludes($script);
}

 

 

 

Alia Team
Alia Oct 14 '13
Thanks for sharing Dave.
I am sure that for those who try to pass w3c validator this is a useful solution.
We will keep this in mind as well ( when we get to rewrite the script to meet all requirements).