[MOD] visual integration 3rd party scripts

Do something cool with CMS? Show us ...
This board is for 'Answers', and the discussion of answers... Not for questions.
Post Reply
essexboyracer
Forum Members
Forum Members
Posts: 85
Joined: Wed Jun 20, 2007 5:40 pm

[MOD] visual integration 3rd party scripts

Post by essexboyracer »

Heres a dirty way of integrating 3rd party scripts into the look and feel of your site, basically what it does is read a page with a delimter in the content area, seperate into two strings, header and footer, then writes the strings to two files, header.html and footer.html.

Steps to follow;

1. Create a new page within CMSMS, enter in the content area (less the quotes) ""

2. Put the following code at the top of the 3rd party script php page you want headers and footers for

Code: Select all


function getContentOfURL($url){  
    $file = fopen($url, "r");   
    if($file){  
        while (!feof ($file)) {    
            $line .= fread ($file, 1024*50);    
        }  
        return $line;  
    }  
}  


function writeURL($filename, $content){  

    // Change this path to where your scripts templates live
    $path = '/home/public_html/script/templates/' . $filename;

    if (!$handle = fopen($path, 'w')) { exit; }

    if (fwrite($handle, $content) === FALSE) { exit; }

    fclose($handle);
}


// Enter the location of the page created in step 1 above. 
// Note: I have URL rewriting on
$string = getContentOfURL("http://www.domain.co.uk/3rdptytemplate.htm"); 

$header = substr($string, 0, strpos($string, '<delimiter>'));
$footer = strstr($string, '<delimiter>');

// If your script uses different file names for headers and footers, change those here.
$writeHeader = writeURL('header.html', $header);
$writeFooter = writeURL('footer.html', $footer);

3. Create two blank files, header.html and footer.html, upload them to the /script/templates/ directory, set permissions 777

4. Run your script and it should work.

I have used this on sphider, a php site search engine.
Post Reply

Return to “Tips and Tricks”