How to create a plugin

Andrew

New Member
So here is my code to display on the homepage only except the first if statement is always evaluated as true on all pages. Any help would be appreciated.

I am using the global_start hook.

Code:
if(empty($FORM['a']) && empty($FORM['app']) && empty($FORM['method']) && empty($FORM['cat'])){
        $path = $_SERVER['DOCUMENT_ROOT'];
        $path .= "/tla.php";
        include_once($path);
        $TMPL['TLA'] = tla_ads();
        $TMPL['sidebar_1_bottom'] .= $TMPL['TLA'];
        $TMPL['sidebar_1_bottom'] .= "This is homepage";
}
else
{
        $TMPL['errormsg'] = "This is not homepage";
        $TMPL['sidebar_1_bottom'] .= $TMPL['errormsg'];
}
 

Andrew

New Member
I used this instead

Code:
$urlpath = $_SERVER['REQUEST_URI'];
if($urlpath == "/" || $urlpath == ""){
 

Andrew

New Member
One last error

including this in my global_start.php gives me an error

Code:
$TMPL['sidebar_1_bottom'] .= $this->do_plugin_skin('./plugins/HomepageTextLinks','text_links_homepage');

Code:
 PHP Fatal error:  Using $this when not in object context in /var/www/html/index.php(156) : eval()'d code on line 3
 

Mark

Administrator
Staff member
to work with some hosting environment where /stats/ was reserved, the stats.php file is now details.php
 

Mark

Administrator
Staff member
The file name needs to match your plugin hook location.

So instead of my-plugin-text.php rename that file to global_start.php

The file name dictates where your code will be inserted.
 
Top