Has anyone tried it. If so, how easy was it?
Integration of phpadsnew with vb3
Collapse
X
-
You might get a better response on www.vbulletin.org, the official vB hacking site. We deal mostly with the default software here, not hacks. -
Very easy.
Step 1
Create a banner.php file that contains only the PHP code to show the banner (generated by phpAdsNew), enclosed in <% %>.
Step 2
In your phpinclude_start template, put:
Code:ob_start(); require("/full/path/to/your/file/banner.php"); $mybanner= ob_get_contents(); ob_end_clean();
In your header template, or wherever you want the banner to appear, put:
Code:$mybanner
Comment
-
Conqsoft,
I have tried your method above, and have run into a snag:
I created a php file called banner3.php :
<?php
if ( $foruminfo[title] == "" )
if (@include(getenv('DOCUMENT_ROOT').'/ads/phpadsnew.inc.php')) {
if (!isset($phpAds_context)) $phpAds_context = array();
$phpAds_raw = view_raw ('National', 0, '_blank', '', '0', $phpAds_context);
echo $phpAds_raw['html'];
}
else
if (@include(getenv('DOCUMENT_ROOT').'/ads/phpadsnew.inc.php')) {
if (!isset($phpAds_context)) $phpAds_context = array();
$phpAds_raw = view_raw ('$foruminfo[title]', 0, '_blank', '', '0', $phpAds_context);
echo $phpAds_raw['html'];
}
?>
Then, in phpinclude_start
ob_start();
require("ads/banner3.php");
$mybanner= ob_get_contents();
ob_end_clean();
Then, in the header template, I placed:
$mybanner
My Problem / question:
The first part of the IF stmt validates, ie it displays the "national" banner. The "else" part does not work however. Nothing displays at all.
Is the $foruminfo[title] field even available in header template?
Do you have any ideas why this doesn't work? I am not a programmer, I have gotten all this from reading, and PHP for dummies. I would appreciate any insight that you may have.
Thanks in advance.Comment
-
-
I need to do the if stmt for the header banner, in order for the banner to be forum specific.
Since the header template wont accept php, you have to do it outside, correct?Comment
-
Originally posted by RocketDawgI need to do the if stmt for the header banner, in order for the banner to be forum specific.
Since the header template wont accept php, you have to do it outside, correct?
The code inside banner.php won't be aware of any vBulletin variables, so you can't do the comparison there.Comment
-
But how can you do an "if" stmt in the header, if the header template wont accept php?
Will the header template accept it if I insert
<?php
if.. blah blah
?>Comment
-
-
-
Originally posted by RocketDawgany chance you could give me a short example to get me started?
Code:<if condition="$forumid == X"> CODE HERE </if>
Comment
-
Thank you Jake, I will play with it for a while now and see what I can come up with. Just to check my syntax,
<if condition="$forumid == ">
CODE HERE
</if>
Will that check for a blank forum id #?Comment
-
Use this code to check for "no forumid":
Code:<if condition="!$forumid"> CODE HERE </if>
Comment
-
Perfect, that is what I needed. The point is that on the main index page, there is no forum ID, and there I wish to display one set of banners, and then inside the forums, I wish to display a different set of banners.
I will come back later and post up if I am successful, because I have seen many similar questions.
Thanks Jake and all.Comment
widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Comment