Home User CP Browse Members Calendar Register Today!  
Get New posts Faq / Help?
   

Not A Member Yet? Register today and become part of the community.

Go Back   Profuse Host Forum > Hosting Section > Knowledge Base > Tutorials

Tutorials Contribute only full How-To's and Tutorials here. Submit Tutorials, Guides and Hints. ALL TUTORIALS ARE MODERATED AND YOUR TUTORIAL WILL *NOT* BE *VISIBLE* UNTIL IT IS ACCEPTED.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-01-2005, 06:15 AM
wapowell
Status: Offline
Member
 
Join Date: Nov 2005
Posts: 5
wapowell is on a distinguished road
Lightbulb How-TO: ProfuseHost Ad Block in PHP-Nuke

Here's a pretty simple how to for adding the Profusehost ads in php-nuke.

I seperated the how to into two sections.
  1. Header

    For making a header I implemented the request of Fenwick to have the code check to see the presence of a file (in this case the ad code). This also worked out great since PHP-Nuke has issues parsing jscript if added directly into the nuke files.

    To add a banner above your phpnuke site you'll need a html file in your web root (or nuke root if you installed to a subdirectory) containing the ad code for the banner:

    Code:
    <script language=\\\\\\\\\\\'JavaScript\\\\\\\\\\\' type=\\\\\\\\\\\'text/javascript\\\\\\\\\\\' src=\\\\\\\\\\\'http://ads2.psychz.net/adx.js\\\\\\\\\\\'></script>
    <script language=\\\\\\\\\\\'JavaScript\\\\\\\\\\\' type=\\\\\\\\\\\'text/javascript\\\\\\\\\\\'>
    <!--
    if (!document.phpAds_used) document.phpAds_used = \\\\\\\\\\\',\\\\\\\\\\\';
    phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,11);
     
    document.write ("<" + "script language=\\\\\\\\\\\'JavaScript\\\\\\\\\\\' type=\\\\\\\\\\\'text/javascript\\\\\\\\\\\' src=\\\\\\\\\\\'");
    document.write ("http://ads2.psychz.net/adjs.php?n=" + phpAds_random);
    document.write ("&amp;what=zone:8");
    document.write ("&amp;exclude=" + document.phpAds_used);
    if (document.referrer)
    document.write ("&amp;referer=" + escape(document.referrer));
    document.write ("\\\\\\\\\\\'><" + "/script>");
    //-->
    </script><noscript><a href=\\\\\\\\\\\'http://ads2.psychz.net/adclick.php?n=a477094b\\\\\\\\\\\' target=\\\\\\\\\\\'_blank\\\\\\\\\\\'><img src=\\\\\\\\\\\'http://ads2.psychz.net/adview.php?what=zone:8&amp;n=a477094b\\\\\\\\\\\' border=\\\\\\\\\\\'0\\\\\\\\\\\' alt=\\\\\\\\\\\'\\\\\\\\\\\'></a></noscript>
    Now, in your web root (or nuke root if you installed nuke to a subdirectory) locate the header.php file.

    Look for the line that says
    Code:
     = 1;
    (line 26 in php-nuke 7.8) and insert the following after it:

    Code:
     = \\\\\\\\\\\'banner.html\\\\\\\\\\\';
    	If (file_exists()) {
    	ob_start(); 
    	include("banner.html");
    	 = ob_get_contents();
    	ob_end_clean(); 
    	 = ;
    	?> <center <?
       	echo ;
    	} else {}
    In my case, I named the profusehost banner "banner.html". If you named it something different then this is where you would change "$profusehostbanner" to match your banner html file name.

    Basically, this code will look to see if the banner.html file exists. If it does then it will parse it and display it in the center, above the nuke header of your theme. If banner.html does not exist, then it does not draw anything above the theme header. So, if you have only one theme, or allow your users to change themes, the banner ad will still be there.

    Now you should be able to view the nuke and it will show the banner ad on the top above your nuke header. I tried moving the code snippet to have the ad banner below the nuke header but it would insert the banner between the left and right blocks, and depending on the dimensions of your theme it could mess up the layout... so I moved the snippet back to the top. This would accomplish the purpose of adding the banner without requiring any further code modifications.

  2. Block

    If you are having difficulties creating an ad block in PHP Nuke (for placement on the right or left side) then this section is for you.

    To use java script in a block is a bit tricky, so I think it is a bit easier to create an ad block by using includes.

    Here's the step by step:
    • Create a html file and include the profusehost ad code:

    Code:
    <script language=\\\\\\\\\\\'JavaScript\\\\\\\\\\\' type=\\\\\\\\\\\'text/javascript\\\\\\\\\\\' src=\\\\\\\\\\\'http://ads2.psychz.net/adx.js\\\\\\\\\\\'></script>
    <script language=\\\\\\\\\\\'JavaScript\\\\\\\\\\\' type=\\\\\\\\\\\'text/javascript\\\\\\\\\\\'>
    <!--
    if (!document.phpAds_used) document.phpAds_used = \\\\\\\\\\\',\\\\\\\\\\\';
    phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,11);
     
    document.write ("<" + "script language=\\\\\\\\\\\'JavaScript\\\\\\\\\\\' type=\\\\\\\\\\\'text/javascript\\\\\\\\\\\' src=\\\\\\\\\\\'");
    document.write ("http://ads2.psychz.net/adjs.php?n=" + phpAds_random);
    document.write ("&amp;what=zone:9");
    document.write ("&amp;exclude=" + document.phpAds_used);
    if (document.referrer)
         document.write ("&amp;referer=" + escape(document.referrer));
    document.write ("\\\\\\\\\\\'><" + "/script>");
    //-->
    </script><noscript><a href=\\\\\\\\\\\'http://ads2.psychz.net/adclick.php?n=a146f950\\\\\\\\\\\' target=\\\\\\\\\\\'_blank\\\\\\\\\\\'><img src=\\\\\\\\\\\'http://ads2.psychz.net/adview.php?what=zone:9&amp;n=a146f950\\\\\\\\\\\' border=\\\\\\\\\\\'0\\\\\\\\\\\' alt=\\\\\\\\\\\'\\\\\\\\\\\'></a></noscript>
    Let's assume you named this file profusehost.html and uploaded it to your web root directory (public_html) or your nuke subdirectory (if you installed nuke to a subdirectory instead of your public_html directory).

    • Now, navigate to your blocks directory and create a php file called block-profusehost.php. In this file the contents would look like:
    Code:
    <?
    ob_start(); 
    include("profusehost.html");
     = ob_get_contents();
    ob_end_clean(); 
     = ;
    ?>
    • Now go to your admin page for nuke and add a new block. If you followed those instructions then you should see a filename for profusehost.
I hope this helps anyone that has been strugling with adding jscript in a block for advertisements.

If you choose to have the ad in a block on the right side, there is an issue in php-nuke where the right hand blocks are at times not shown (using the Forums is a good example). If the ad is in a block on the right side of your site, and ir rendered hidden (such as by going to the forums in php-nuke) then you would technically be out of compliance with the TOS of profuse host. If using a block, the left side would be better as it is never hidden. But for better layout I recommend the header solution.

If you have any questions, let me know and I'll try to help.

Thanks,

-Bill

Last edited by wapowell : 12-02-2005 at 06:54 AM.
Reply With Quote

  #2 (permalink)  
Old 12-01-2005, 09:04 AM
John
Status: Offline
Administrator
 
Join Date: Sep 2005
Posts: 439
John has disabled reputation
Default

whoa thanks alot for this :-). can you please give me your website url.
Reply With Quote

  #3 (permalink)  
Old 12-01-2005, 06:33 PM
Fenwick
Status: Offline
Member
 
Join Date: Oct 2005
Posts: 5
Fenwick is on a distinguished road
Default

Bill,

I haven't tried your idea, but at first glance, I question the location of the "profusehost.html" file. Instead of the root of the account directory, it needs to be placed in the root of the PHP-Nuke sub-directory. Then your call in this snippet will work, otherwise need to change the location of the call to ../profusehost.html

Code:
<?
ob_start(); 
include("../profusehost.html");
 = ob_get_contents();
ob_end_clean(); 
 = ;
?>
Or is that one single dot,

./profusehost.html

instead of

../profusehost.html

I can't remember, of course I might be wrong about this entire comment.

No matter - once the correct procedure is confirmed, and it meets the approval of John and his requirements, this process is worthy of being placed in the KnowledgeBase (IMHO).

~~~~~~~~~~~~~~~~~~~~

Bill,
(Pretend I am on my knees begging).

How about a workaround or the correct placement for a header banner ad display within PHP-Nuke. Currently I am focused on a custom header PHP file, that the mainfile.php does look for and if not found, displays the default header of the default theme. Of which I will eliminate all other themes to make life easier and that as site designer, I decide what it looks like ..

Second, - need to do the same for WikiPedia, banner in the header area (preferred). However even a side skyscraper be (groan) acceptable.

Any help would be greatfully appreciated, when you have time of course. No immediate rush.

I do like the idea you presented, but if a Nuke-based site has material on all three columns, this might be crowding a little bit, or impact design. Of course this is trivial when meeting the TOS requirements concerning the displayed ad.

Thanks friend.

If you would like to roam at a running WikiPedia on Profusehost, just let me know. This is one of the few servers I have found that actually allows for the installation script to fully run and configure a "localsettings.php" file that initiates the WikiPedia.

P.S. Seems the auto installation of WikiWeb in PHP is corrupt via the cPanel, and I much prefer WikiPedia to WikiWeb. (That and unless others desire WikiWeb, no point in isolating the negativbe issue on the install process).

Peace all
__________________
Imagination is the Only Limitation


Internet safety and security, technology, discussion, web design, and community based discussions regarding several projects including FreeBSD as a alternative operating system:

Click here to visit

Last edited by Fenwick : 12-01-2005 at 06:45 PM.
Reply With Quote

  #4 (permalink)  
Old 12-01-2005, 10:01 PM
wapowell
Status: Offline
Member
 
Join Date: Nov 2005
Posts: 5
wapowell is on a distinguished road
Default

Thanks for catching the typo! Of course I didn't mean the ROOT directory, I assumed one would know that I am speaking of the WEB root directory (public_html) but of course I shouldn't have made that assumption. I edited the original post to be a bit clearer. Thanks for that! So now assuming the file is in the web root ( or root of the subdir where nuke was installed - if it was installed in a sub dir of the web root) the instructions are correct, a ./ or ../ is not needed. Example, I tested this on my developement box where I have nuke installed in the sandbox (http://localhost/sandbox/nuke78/) and used the exact code snippets from there in the posting above. So it shouldn't matter if one uses the web root or a subdir (like on my developement box).

John, if you want I will upload the nuke to my site so you can see the example (though I don't use nuke anymore - I switched to Mambo, but I can put it up there for others to see if you like).

Also, today I can check out the mainfile.php to see about including a widescreen ad instead of skyscraper in a block.

As far as the Wiki, I haven't used Wikiweb but I have used MediaWiki which powers Wikipedia (and other MediaWiki projects). I can check into adding the banner to the header of Mediawiki also today. I agree, for Mediawiki (and even phpnuke for that matter) I would personally prefer a header ad vice a skyscaper ad, but I guess to each his/her own. I'll see if I can bang out both options for phpnuke and Mediawiki today before I go to bed.

Regarding install issues via cpanel, I have no idea. I usually develop locally, then once it looks/feels the way I like I upload it to profusehost and create the databases and such on profusehost. I haven't used the installers from the cpanel.

Thanks again for checking my post and correcting what could have been a misunderstanding for some folks!

-Bill
Reply With Quote

  #5 (permalink)  
Old 12-02-2005, 12:48 AM
Fenwick
Status: Offline
Member
 
Join Date: Oct 2005
Posts: 5
Fenwick is on a distinguished road
Default

Bill,

Stat sheets records you getting the points, I just get the assist.

If you like Bill and John, saving Bill the upload, I can try his suggestion on a backup copy of PHP-Nuke I have on my site that I will be deleting soon.

Please allow me to clarify that I am (hoping to get TOS compliant) using "MediaWiki" and I was mistaken with identifying it as WikiPedia.

MediaWiki, when the banner ads are automated displays the banner ad on top of or rather over the header area for MediaWiki and it really looks sad. Hoping somehow to bump down the content of MediaWiki in order to allow the banner to be displayed above any of the actual content, not over.

Seems that the support for MediaWiki is rather vague, especially when setting permissions, so someday, if you have the time, would really like to exchange PMs or I know a few places that have a live chat (happy to share thePERL script for this no frills yet secure chat).

Mambo vs. PHP-Nuke

I played with Mambo all day, and had some fun exploring its potential. Hardest part was after installing "SimpleForum" and trying to figure out how that component could be added in the menu, of which I eventually solved thru trial and error, mostly error, but I managed.

PHP blocks allow for easier integration, but I am sure the same is possible the "Mambo" way. Might use both for different projects. Just to have some fun.

Quote:
Also, today I can check out the mainfile.php to see about including a widescreen ad instead of skyscraper in a block.
Thanks in advance, myself and I am sure others would appreciate this very much.

I also wiosh to thank you in advance for any tweaks regarding header banner ad in MediaWiki.

Hopefully thisprocess can be used as a guidance in otherPHP scriptpackages, like for example "Gallery 2.0" from http://gallery.sourceforge.net/

Quote:
I usually develop locally, then once it looks/feels the way I like I upload it to profusehost and create the databases and such on profusehost.
We think alike.

Don't stay up too late working on this.

Peace......
__________________
Imagination is the Only Limitation


Internet safety and security, technology, discussion, web design, and community based discussions regarding several projects including FreeBSD as a alternative operating system:

Click here to visit

Last edited by Fenwick : 12-02-2005 at 12:51 AM.
Reply With Quote

  #6 (permalink)  
Old 12-02-2005, 07:07 AM
wapowell
Status: Offline
Member
 
Join Date: Nov 2005
Posts: 5
wapowell is on a distinguished road
Default

Ok, I updated the how-to to include instructions for how to have a banner in php-nuke, or a block.

John, you asked for the url for my site... since my site is mambo I put up a nuke site at the following url: http://www.wapowell.com/demos/nuke78/. There, one can see both a banner ad using my instructions in the post, and a right side block ad. I left both ads in there to demonstrate the code snippets, as well as to demonstrate that when one goes to the forums module, it completely covers the right side blocks (thus if the user is using ONLY right side blocks they would technically be out of compliance with the TOS).

Fenwick, the code for adding the ad to the header will check to see the existence of the "banner.html" file. If it exists, it will display the ad above the theme header regardless of which theme is selected. If it doesn't exist then it displays nothing and doesn't interfere with the layout at all. I tried to allow for the user that wants only one theme (more control over his/her layout) as well as the user that wants his/her users to choose any theme they want (not sure why one would do that since they all have different headers, but whatever. To each his own).

As far as the mediawiki that will be a bit more challenging. Mediawiki doesn't have a "header" function built in per se, so as you found out if you insert the ad code it just makes it an overlay in the "header" area instead of nudging the rest of the page down to make room for the header. I don't doubt it can be done, but it would be a bit more coding than the nuke solution was. I'll keep plugging away at it if you want, though it will have to be continued for today (I have to work in the morning).

Anyway, if you don't mind taking a peek at the updated how-to and let me know if you find typos/code mistakes.

Thanks,

-Bill
Reply With Quote

  #7 (permalink)  
Old 12-02-2005, 11:02 AM
Fenwick
Status: Offline
Member
 
Join Date: Oct 2005
Posts: 5
Fenwick is on a distinguished road
Default

Bill,

No rush on rtthe MediaWiki tweak. As you are, I am also doing several things at once, but would like to use MediaWiki for a sopecial project and yet be TOS compliant.

Not expecting a miracle tomorrow, but hopefully we can bang something out in a reasonable amount of time.

Take care
__________________
Imagination is the Only Limitation


Internet safety and security, technology, discussion, web design, and community based discussions regarding several projects including FreeBSD as a alternative operating system:

Click here to visit
Reply With Quote

  #8 (permalink)  
Old 12-02-2005, 10:46 PM
John
Status: Offline
Administrator
 
Join Date: Sep 2005
Posts: 439
John has disabled reputation
Default

Quote:
Originally Posted by wapowell
Ok, I updated the how-to to include instructions for how to have a banner in php-nuke, or a block.

John, you asked for the url for my site... since my site is mambo I put up a nuke site at the following url: http://www.wapowell.com/demos/nuke78/. There, one can see both a banner ad using my instructions in the post, and a right side block ad. I left both ads in there to demonstrate the code snippets, as well as to demonstrate that when one goes to the forums module, it completely covers the right side blocks (thus if the user is using ONLY right side blocks they would technically be out of compliance with the TOS).

Fenwick, the code for adding the ad to the header will check to see the existence of the "banner.html" file. If it exists, it will display the ad above the theme header regardless of which theme is selected. If it doesn't exist then it displays nothing and doesn't interfere with the layout at all. I tried to allow for the user that wants only one theme (more control over his/her layout) as well as the user that wants his/her users to choose any theme they want (not sure why one would do that since they all have different headers, but whatever. To each his own).

As far as the mediawiki that will be a bit more challenging. Mediawiki doesn't have a "header" function built in per se, so as you found out if you insert the ad code it just makes it an overlay in the "header" area instead of nudging the rest of the page down to make room for the header. I don't doubt it can be done, but it would be a bit more coding than the nuke solution was. I'll keep plugging away at it if you want, though it will have to be continued for today (I have to work in the morning).

Anyway, if you don't mind taking a peek at the updated how-to and let me know if you find typos/code mistakes.

Thanks,

-Bill
thanks alot. I just checked the demo site for ads and everything looks perfect. thanks again for this.
Reply With Quote

  #9 (permalink)  
Old 12-08-2005, 11:18 AM
Fenwick
Status: Offline
Member
 
Join Date: Oct 2005
Posts: 5
Fenwick is on a distinguished road
Default

I just stumbled across this and will be making the header tweak on myNuke site ASAP so that at least that portion, (and checking all stagnant HTML pages as well for the proper banner display) will be TOS compliant.

Thank you Bill, for your time and effort in solving this delimma from myself, and all others whom will find this useful.

Perhaps in time, John (or anyone whom assists him) can apply this to the auto install via cPanel so that this can be universal as far as the header display is concerned.
__________________
Imagination is the Only Limitation


Internet safety and security, technology, discussion, web design, and community based discussions regarding several projects including FreeBSD as a alternative operating system:

Click here to visit
Reply With Quote

  #10 (permalink)  
Old 12-08-2005, 12:55 PM
Fenwick
Status: Offline
Member
 
Join Date: Oct 2005
Posts: 5
Fenwick is on a distinguished road
Default

I can confidently state that this tweak does in fact work regarding the header display of the banner ad as required by the TOS. Feel free to visit my site mentioned in the signature to confirm this and see for yourself.

However, maybe this next part is irrelevant, or those of us working on this tweak missed it?

I recall that when advertizing was automated that there was a text link in the footer area.

If this is still required, an additional edit to the PHP-Nuke footer file is required to display this text link.

Snippet from the original footer.php file in the Nuke root directory. (very bottom of the file)

Code:
~~~

    echo "</body>\n"
		." </html>";
    die();
}

foot();

?>
By editing the file to include the following, the footer will include a text link in each and every page display of the Nuke script package.

Code:
    echo "</body>\n"
		." <br><br>Web Hosting Provided By <a href=\\\\\\\\\\\'http://www.profusehost.net/\\\\\\\\\\\' Target=\\\\\\\\\\\'_New\\\\\\\\\\\'>ProfuseHost.net</a><br><br> </html>";
    die();
}

foot();

?>
the addition of this snippet:

Code:
<br><br>Web Hosting Provided By <a href=\\\\\\\\\\\'http://www.profusehost.net/ Target=\\\\\\\\\\\'_New\\\\\\\\\\\'>ProfuseHost.net</a><br><br>
Establishes the following inclussion centered in the footer (One could see this in action again at my site mentioned in my signature, in the fotter position

Web Hosting Provided By ProfuseHost.net.

Again, I am not sure if this is required, but if it appears in the automatic generated pages, it should be included in the manual method of complying with the TOS with regards to PHP Nuke-based sites.

This is something that John will reply to when he has time.
__________________
Imagination is the Only Limitation


Internet safety and security, technology, discussion, web design, and community based discussions regarding several projects including FreeBSD as a alternative operating system:

Click here to visit

Last edited by Fenwick : 12-08-2005 at 01:07 PM.
Reply With Quote

  #11 (permalink)  
Old 12-08-2005, 10:00 PM
wapowell
Status: Offline
Member
 
Join Date: Nov 2005
Posts: 5
wapowell is on a distinguished road
Default

Hi Fenwick,

Thanks for verifying the code!

Yeah your right, my code ONLY addresses the ad placement, not the footer requirement of the TOS. I didn't mod the footer.php because it isn't necessary. PHP-nuke has a gui in the administration area where you can just type custom footers (3 footer sections in 7.8, not sure about the other versions) in either text or html. Since adding the footer didn't "require" coding/modifying the footer.php I didn't include that in the how-to.

Once you log into the administrator module, click on preferences. Scroll down a bit and you will see three boxes with WYSIWYG editors for three different footer blocks.

But of course, one could also just modify the footer.php file and do the same thing!

Thanks,

-Bill
Reply With Quote

Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
is it possible to block a pay as you go sim card? Lewis G General Mobile Phone Discussion 1 10-02-2008 11:01 AM
PHP Nuke our-lounge Request Auto Ad Removal Here 3 04-06-2007 12:14 PM
squery and teamspeak block problems svsnipa Free Web Hosting Support 8 03-10-2007 01:26 PM
PHP Nuke our-lounge Free Web Hosting Support 6 02-17-2007 05:31 PM
PHP Nuke our-lounge Free Web Hosting Support 1 02-14-2007 10:43 PM


All times are GMT -7. The time now is 07:41 PM.

Skin Design By vBSkinworks



Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.

Sponsored by Web Hosting


Profuse Solutions LLC

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80