MyBB Community Forums

Full Version: install of textlinkads program
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
SO here it is. My forum is running on MyBB 1.2.7. I'm interested in placing text link ads from text-link-ads.com. Anyone done it successfully before? I'm an inexperienced coder so keep that in mind while you read below.

I get their (textlinkads) php code, set a variable with it in global.php and then call that variable in the header template, no luck. I get a error code that seems to suggest to me that their php code isn't formatted properly (from searching the error code in Google). I don't know if that's correct, I figure it's my error, so I remove all of that coding and move on to try something else a different way.

I mistakenly move on to try and create a new 'setting' in the admin panel. Nothing seems to happen so I move on.

Eventually, I end up trying to create my own plugin with their php code (from plugin creation guides in this forum). After messing around with that for a while I'm actually successful and my plugin shows correctly in the plugin manager. HOWEVER, my textlinkads now show up at the top of my admin section, not in my forum. Hmmmm. Whenever I activate or deactivate the plugin in the plugin manager, the text link ads moves between the top of my admin panel to just under the navigation tree of the header. with that.

So I move on to try and get the ads to show up in my form so I place a $plugins->run_hooks to the plugin index.php and portal.php page. I get an error saying the header has already been called by something else blah, blah.

Can anyone diagnose what I need to do to get back to square one and do this properly?

Thanks,
N
I would need your plugin code to help you out. You can upload it as an attachment.
Isn't the code they give you Javascript? Place the code they tell you to insert.
The simplest way would probably be the first procedure you outlined:
Quote:I get their (textlinkads) php code, set a variable with it in global.php and then call that variable in the header template, no luck. I get a error code that seems to suggest to me that their php code isn't formatted properly (from searching the error code in Google). I don't know if that's correct, I figure it's my error, so I remove all of that coding and move on to try something else a different way.

If you could post the error here, maybe it's something simple that can be fixed.
labrocca Wrote:Isn't the code they give you Javascript? Place the code they tell you to insert.
No, its all done server side.
ok so I've attached the php code supplied by text-link-ads.com. I chose php from them (for obvious reasons) but they also provide many other coding options.

Now when I set the variable in global.php I get the following error. I get the error immediately (even before I change the header (footer, etc.) to call the variable.

Parse error: parse error, unexpected T_STRING in /hsphere/local/home/ncurrier/gaming-forums.org/forums/global.php on line 122

This is what I searched and found it may be a problem with the formatting of their code they provided.

Thanks for your help so far guys.

N
ok. so what's happening is i'm setting the variable in global.php with the following syntax

$var = 'code';

so the code is enclosed in single quotes. however, when the code contains another single quote, it closes the first single quote i'm using to define my variable. what's the way around this?

i'm sure this is the problem 95% of the people (php newbies) out there are having when setting variables in php. just do a google search for "Parse error: parse error, unexpected T_STRING" and you'll see how frequently this happens.

Funny though, in all of those google results I didn't find the solution.
escape it. \'
Neutron, are you saying you're putting all the code from the file you attached in your previous post into a single variable? I just tested that on a smaller scale, and it seems to output the code as text rather than running the code.
ok so I escape all of the single quotes in the code as Tikitiki advised and do not get the t_string parse error. good. However, I do get the text written out on my page as MrDoom points out. It's a section of the code itself.

\n"; for ($i = 0; $i < count($arr_xml['URL']); $i++) { if( isset($arr_xml['PostID'][$i]) && $arr_xml['PostID'][$i] > 0 ) continue; echo "
".$arr_xml['BeforeText'][$i]." ".$arr_xml['Text'][$i]." ".$arr_xml['AfterText'][$i]."\n"; } echo "
"; } } function tla_updateLocalXML($url, $file, $time_out) { if($handle = fopen($file, "a")){ fwrite($handle, "\n"); fclose($handle); } if($xml = file_get_contents_tla($url, $time_out)) { $xml = substr($xml, strpos($xml,'(.*?);

It seems the code isn't being run.
Pages: 1 2 3