The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Comments |
#142
|
|||
|
|||
Would any of my proposed fixes work for this, PPN?
|
#143
|
|||
|
|||
PPN,
I modified your hack and have now got it to randomise the adverts successfully. As I said before, I am not a programmer, so my code is probably inefficient in performing the task - when I post the code here, you and others can hopefully assist in that respect. The only thing with my modification is that I have disabled the 'show on whole board' functionality. Basically, I didn't need it for my purpose. I'm at work now and don't have access to my laptop. I will post my code to this thread over the next few days. Once again, thanks for the hack. Willie |
#144
|
|||
|
|||
I guess I found the error I reported some posts before (banners not shown on directly linked posts).
If the script finds something like "&threadid=19938" then the banner gets displayed. But if you directly link to a post, it contains "?postid=172199" and the banner does not get displayed. Can someone fix this so banners get displayed on every page? Thanks in advance, Sebastian |
#145
|
|||
|
|||
Hi PPN,
any news on the new version of this hack? Also, will it work with the latest stable version of Vbulletin (2.2.9)? Keep up the good work! Thanks, Marco. |
#146
|
|||
|
|||
Further to my post above, here are the changes I made to PPN's hack to make it randomise. As I said, let us all work together to make my code more efficient.
Willie ////////////////////START////////////////////////// In global.php, FIND: if(isset($advert_forumid)) { $foruminfo = getforuminfo($advert_forumid); $advert=$DB_site->query_first("SELECT * FROM ads WHERE LOCATE(CONCAT(',',forumid,','),',$foruminfo[parentlist],')>0 AND time>=".time()." AND (exposed<=exposures OR exposures=0) ORDER BY RAND()"); } else { $advert=$DB_site->query_first("SELECT * FROM ads WHERE wholeforum='1' AND time>=".time()." AND (exposed<=exposures OR exposures=0) ORDER BY RAND()"); } AND REPLACE IT WITH: $DB_site; $sql="SELECT * FROM ads WHERE LOCATE(CONCAT(',',forumid,','),',$foruminfo[parentlist],')>0 AND time>=".time()." AND (exposed<=exposures OR exposures=0) ORDER BY RAND()"; $advert1 = mysql_query($sql); $advert2 = mysql_query($sql); $adcounter=0; while($countrow = mysql_fetch_row($advert1)) { $adcounter++; } $act1=rand(0,$adcounter-1); $adcounter3=0; while($countrow3 = mysql_fetch_row($advert2)) { if($adcounter3==$act1) { $DB_site->query("UPDATE ads SET exposed=exposed+1 WHERE adid='$countrow3[0]'"); eval("\$advert = trim(\"".str_replace("\'", "'", addslashes($countrow3[7]))."\");"); } $adcounter3++; } ///////////////END/////////////////// I just noticed that there is another block of code that should also be included in the Find It and Replace above, essentially it's the code immediately following that set out above and beginning with $DB_site->query("UPDATE ads SET exposed - one query only. |
#147
|
|||
|
|||
Now, let me understand you correctly. This code works, but it eliminates the "Show on all forums" functionality?
|
#148
|
|||
|
|||
Correct.
Adverts on child forums will be pooled together with adverts on their parent forums (and their parents...) as before. One advert will then be picked from the pool. Therefore, insertion of an advert at the ultimate parent level could be one way of displaying it on the entire forum. Test my code and see if it suits your needs. Willie |
#149
|
|||
|
|||
Willie
I tried your fix but lost all my ads. Not one is showing up. I made sure they were not selected for show all fourms. Just had them in child forums Matt |
#150
|
||||
|
||||
Quote:
|
#151
|
||||
|
||||
When I run this query:
CREATE TABLE `ads` ( `adid` smallint(5) NOT NULL auto_increment, `name` varchar(25) NOT NULL default '', `forumid` smallint(5) NOT NULL default '0', `wholeforum` smallint(1) NOT NULL default '0', `exposed` smallint(10) NOT NULL default '0', `exposures` smallint(10) NOT NULL default '0', `time` int(10) NOT NULL default '0', `advert` text NOT NULL, KEY `adid` (`adid`) ); I get this error: MySQL said: You have an error in your SQL syntax near '\'\', `forumid` smallint(5) NOT NULL default \'0\', `wholeforum` smallint(' at line 3 Any ideas? |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|