Core Modules & Blocks  :: 
full url for images and links?
 Top

  • Im trying to modify the .htaccess file for short urls so that all images and links are using the full domain URL.

    Images example:

    Code

    src="themes/themename/images/test.gif"

    would be:

    src="http://domain.com/themes/themes/themename/images/test.gif"


    Links would normally be:

    Code

    href="Downloads.htm"

    would then be:

    href="http://domain.com/Downloads.htm"


    Im needing this for other mod_rewrite purposes that i am working on and for some reason I cant get it working. I have been searching the net for examples and have found a few that seem close, but no cigar.
  • Duh, my fault. Wasnt even thinking. I have to do this with the xanthia output filter. At least thats what im thinking. No luck so far, but im getting closer.
  • ok, got it working. Added these two lines the the outputfilter.function.php plugin:

    $source = str_replace("href=\"", "href=\"http://".$_SERVER["HTTP_HOST"]."/", $source);
    $source = str_replace("src=\"", "src=\"http://".$_SERVER["HTTP_HOST"]."/", $source);

    right before:

    $source = preg_replace($in, $out, $source);


    The problem now is that its causing problems with the admin area. Looks like those already include the HTTP_HOST. Will see what i can do.
  • Is there a way to not not include the plugin in the admin panel?
  • For some odd reason the full URL is loaded for pnapi compliant modules, but not the old ones. I have looked a the code, but cant figure out what to modify so that links are not created with the full URL, IE domain.com/index.php?module=Blocks&type=admin instead of just index.php?module=Blocks&type=admin

    Code

    foreach ($adminmodules as $adminmodule) {
            if (pnSecAuthAction(0, "$adminmodule[name]::", '::', ACCESS_EDIT)) {
                $catid = pnModAPIFunc('Admin',
                                      'admin',
                                      'getmodcategory',
                                      array('mid' => pnModGetIDFromName($adminmodule['name'])));
                $modinfo = pnModGetInfo(pnModGetIDFromName($adminmodule['name']));
                if ($modinfo['type'] == 2 || $modinfo['type'] == 3) {
                    $menutexturl = pnModURL($modinfo['name'], 'admin');
                    $menutext = $modinfo['displayname'];
                    $menutexttitle = $modinfo['description'];
                } else {
                    $menutexturl = 'admin.php?module=' . $modinfo['name'];
                    $menutext = $modinfo['displayname'];
                    $menutexttitle =  $modinfo['description'];
                }
                $adminlinks[$catid][] = array('menutexturl' => $menutexturl,
                                              'menutext' => $menutext,
                                              'menutexttitle' => $menutexttitle,
                                              'modname' => $modinfo['name']);
            }
        }
  • Gave up and went another route.

    Code

    $modinfo = pnModGetInfo(pnModGetIDFromName($adminmodule['name']));
        if ($modinfo['type'] == 2 || $modinfo['type'] == 3) {

        $source = str_replace("href=\"", "href=\"http://".$_SERVER["HTTP_HOST"]."/", $source);
        $source = str_replace("src=\"", "src=\"http://".$_SERVER["HTTP_HOST"]."/", $source);

        }


    EDIT: I spoke to soon, this doesnt load it at all now for any module. Woops.
  • Ugly, but i finally got it working. Man this was a one sided conversation =P

    Code

    $source = str_replace("href=\"", "href=\"http://".$_SERVER["HTTP_HOST"]."/", $source);
        $source = str_replace("src=\"", "src=\"http://".$_SERVER["HTTP_HOST"]."/", $source);
        $source = str_replace("href=\"http://".$_SERVER["HTTP_HOST"]."/http://".$_SERVER["HTTP_HOST"]."/", "href=\"http://".$_SERVER["HTTP_HOST"]."/", $source);
This list is based on the users active over the last 60 minutes.