WebsiteBaker Community Forum

WebsiteBaker Support (2.8.x) => Droplets & Snippets => Topic started by: Lonesome Walker on February 09, 2008, 07:15:05 PM

Title: Full URL to actual site
Post by: Lonesome Walker on February 09, 2008, 07:15:05 PM
Due a very lazy user here, i had to use this function:

Code: [Select]
<?php

function actual_site() {

    global 
$database$wb;

    
$page_id $wb->page_id;

    if (
PAGE_ID>0) {

        
$query1=$database->query("SELECT value FROM ".TABLE_PREFIX."settings WHERE name=pages_directory");
        
$directory=$query1->fetchRow();

        
$query2=$database->query("SELECT link FROM ".TABLE_PREFIX."pages WHERE page_id=$page_id");
        
$sitelink=$query2->fetchRow();

        
$query3=$database->query("SELECT value FROM ".TABLE_PREFIX."settings WHERE name=page_extension");
        
$extension=$query3->fetchRow();

    }
    echo 
WB_URL;
    echo 
$directory[0];
    echo 
$sitelink[0];
    echo 
$extension[0];
}

?>


Sure, it could be more efficient, but hey, it works and it is for free  :wink:
Title: Re: Full URL to actual site
Post by: diodak on February 09, 2008, 07:30:21 PM
Hello, O dont know for what you need that, I use

Code: [Select]
<?php echo WB_URL.$_SERVER[&#39;REQUEST_URI&#39;]; ?>
to print site addres when printing PDF by html2pdf module.
Title: Re: Full URL to actual site
Post by: Lonesome Walker on February 09, 2008, 07:35:56 PM
Well, sometimes you need it this way (just think about mod_rewrite...)  :roll: