N2S

Topic: Sidebar Advertisment Space (Except on Homepage)

I am going to help out with this project a little and post some small modifications here and there.
so here is my first "mod/hack".
I am going to try and make every tutorial as simple as possible.

USES: Advertisement space on Category / Pages (I think everything EXCEPT home page)
JOBBER VERSION: 1.5 beta 1 (20/08/2008)
FILE: _templates/sidebar.tpl
FILES USED: http://i33.tinypic.com/2cxdpfm.jpg  (168x253px)

Code:

FIND: 
            {if $smarty.session.last_viewed_jobs}
            <h4>{$translations.header.seen_recently}</h4>
            <ul>
                {section name=last loop=$smarty.session.last_viewed_jobs}
                <li><a href="{$smarty.session.last_viewed_jobs[last].url}">&raquo; {$smarty.session.last_viewed_jobs[last].title}</a></li>
                {/section}
            </ul>
Code:

AFTER ADD:
            <br><a href="#"><img src="http://i33.tinypic.com/2cxdpfm.jpg" border="0"></a>  <!--Advertisment Space-->

DEMO:
http://img291.imageshack.us/img291/9520/exampleqk2.jpg

This will only allow you (as a webmaster) to show only one advertisment throughout the whole website.Obviously you want to maximize revenue so I would suggest finding a simple free ad rotating management script online. Instead of inserting images, you may also insert tables, iframes, dividers, text... The possibilities are endless. Have fun!

A very simple modification, hopefully some of you benefit from this.
Please post and share with the community. Please include jobber version, screenshots, and code that you used!

how do you find the jobber version? (First line in the "changelog.txt" file that was included in your jobber download. It should be the first one you see.)

http://i34.tinypic.com/2affofk.png

flash134

Re: Sidebar Advertisment Space (Except on Homepage)

Thank you so much for your post.  I have to say i have juggled with lots of php job boards and open source stuff but have never found something as easy to use as this.  the code is a credit to it's creators and they deserve a medal for making it open.

just to expand upon your tutorial above i found a script a long time ago for rotating a random image.  What i wanted to do was use your code plus the random code to make those adverts change randomly every time a different page is selected.

heres how i managed it AFTER making the modification above:

Find:

Code:
<br><a href="#"><img src="http://i33.tinypic.com/2cxdpfm.jpg" border="0"></a>  <!--Advertisment Space-->

Replace with:

Code:
{include_php file="_includes/rndimg.php"} <!--adapted from N2S thank you-->

Create a new directory called ads in the img/ directory
Create a new file in the _include directory called rndimg.php
Paste the following:

Code:
<?php

//original script found on totallyphp.co.uk
// Change this to the total number of images in the folder
$total = "2";

// Change to the type of files to use eg. .jpg or .gif
$file_type = ".jpg";

// Change to the location of the folder containing the images
$image_folder = "http://YOURSITEURL.COM/img/ads";

// You do not need to edit below this line

$start = "1";
$random = mt_rand($start, $total);
$image_name = $random . $file_type;
echo "<img src=\"$image_folder/$image_name\" alt=\"$image_name\" />";

?>

Now all you have to do is save the script and design your ads around the shape and size that N2S provided above and rename them 1.jpg, 2.jpg, 3.jpg etc.  Once thats done, upload all the images to the img/ads directory you created earlier and the page now will display a random image each time it is refreshed. 

Please make sure you alter the $total= line in rndimg.php to reflect your own ammount or some images will not show.

To test you can just grab N2S' image and copy it twice, rotate one 180 deegrees, blank one out and keep one original then follow the instructions above remembering to set $total to 3 and you will see them randomly change as you browse your site.

I hope this is helpful and i thank you all yet again for the help on this forum and i will publish any further modifications i make to share with this copmmunity.

Remember

Last edited by flash134 (2008-11-04 11:31:00)

N2S

Re: Sidebar Advertisment Space (Except on Homepage)

the only thing is that i did not see in your script, is that it does not link the image to a website
I currently use a VERY VERY simple and easy system for my advertisment.

http://abledesign.com/programs/banner.php
DEMO: http://tinyurl.com/6c28kj

the only problem that I have encountered was that the page that contains the advertisment, has to be ".php".
(if it is not php, then I use an i-frame.)

http://i34.tinypic.com/2affofk.png

marc-oliver

Re: Sidebar Advertisment Space (Except on Homepage)

Hello N2S,

thanks very much for that inspiration. Do you also have such a nice code snipe for the header? I wanna place a banner on top as well. plaese take a look:

www.jobo-whistler.com

Thanks and warmest regards,

Marc-Oliver, Whistler, BC, Canada

elbsailor

Re: Sidebar Advertisment Space (Except on Homepage)

Hi there,

thank you for that post.

I am just trying to include that banner on ALL pages - except the start page.
My php is too poor to realize that.

I tried the code of the fist posting - but then the banner is also is showng on the start page.

I appreciate professional help ;-)

Danke

Dirk

Chronos

Re: Sidebar Advertisment Space (Except on Homepage)

There's no PHP involved really, just add the HTML code for it in any .TPL file (depending on where you want it to show) and put it between an if-statement that checks whether it is the frontpage or not. See the example below:

Code:
{if $CURRENT_PAGE != ''}<a href="http://www.google.com"><img src="{BASE_URL}img/example_banner.jpg"/></a>{/if}

On the other hand, if you want it to only show on the homepage, simply make it $CURRENT_PAGE == '' instead.

Member of Jobberbase Development Team - Implementation and Coding

Visit my Blog: ChronoScripts (JobberBase scripts, support and freelance)
JobBoards: Telefonisch Werk and Top Bijbaan

elbsailor

Re: Sidebar Advertisment Space (Except on Homepage)

Thanks a lot - I made it running!

TeamProjectsOnly

Re: Sidebar Advertisment Space (Except on Homepage)

Here is a minor update to this Mod. I inserted the ADS, but there was no linking to the image...So

Replace rndimg.php with this

Code:
<?php
//  original script found on totallyphp.co.uk
//   edited by TeamProjectsOnly to add hyperlinks to img - 9/19/2009 

//Change this to the total number of images in the folder
$total = "3";

// Change to the type of files to use eg. .jpg or .gif
$file_type = ".png";

// Change to the location of the folder containing the images
$image_folder = "http://YOURSITEHERE/PATHTO/img/ads";

// This is the random ad generator
$start = "1";
$random = mt_rand($start, $total);
$image_name = $random . $file_type;

// add case stmt and hyperlink for total # of choices
switch ($random) {
    case 1:
        $link_name = "http://ADURLHERE";
        break;
    case 2:
        $link_name = "http://ADURLHERE";
        break;
    case 3:
        $link_name = "http://ADURLHERE";
        break;
}

echo "<a href=\"$link_name\" /><img src=\"$image_folder/$image_name\" alt=\"$image_name\" /></a>";

?>

Add a URL for each image, ie: 1...num of ads.

That's it !

Napolong

Re: Sidebar Advertisment Space (Except on Homepage)

Hello NS2,

I follow your instruction.

The first time it is ok. Picture are displayed on the sidebar.

But now, when I run site on firefox, there's nothing to show.

If I surf the site via IE, they could show a (x) symbol, right click to properties, both type/ size is not availabe.

I have ever try different position for code line, but the problem is still the same.

So pls give me the advice.

Nice day! Tks a lot.

zoomcreator

Re: Sidebar Advertisment Space (Except on Homepage)

Quick question whether anyone knows how to insert Adsense text links for the jobs category sidebar only below jobs seen recently (in the sidebar). Just want the functionality to run text ads below the last job seen in the category sidebar only.

Anyone with any suggested code to enable this ??

Last edited by zoomcreator (2011-12-30 05:33:19)

dvtservices

Re: Sidebar Advertisment Space (Except on Homepage)

Add your  google add code before {if $CURRENT_PAGE == ''}  line

Thanks &Regards
DV Tech Services Pvt Ltd
Email: venkat@dvtservices.com;   www.dvtservices.com  Bangalore. India
                             We are Ready to Resolve your problems ..... And Ready to work for you

zoomcreator

Re: Sidebar Advertisment Space (Except on Homepage)

Thanks for the support.

I tried your suggestion but it adds the code to both the category page and
the job page.

I just want the code to run only on the category page.

I know its just a little bit of code something along the lines of ;

{if $CURRENT_PAGE == $URL_JOB.CATEG}
{literal}
Adsense code
{/literal}
{/if}

The above code does not work but I know its close as;

{if $CURRENT_PAGE == $URL_JOB}
{literal}
Adsense code
{/literal}
{/if}

Will target and ad only for the side bar of the job when selected and no other page.

Any suggestions ?

hobo

Re: Sidebar Advertisment Space (Except on Homepage)

For ads only on category pages try using:

Code:

{if $category_id!= false}
{literal}
javascript for your ads goes here
{/literal}
{/if}

putypuruty

Re: Sidebar Advertisment Space (Except on Homepage)

@zoomcreator

Please try this:

- open _templates\default\category.tpl and add the following line

Code:
{assign var='is_category_page' value=1}

before

Code:
{include file="header.tpl"}

- in _templates\default\sidebar.tpl, add this code at the end

Code:

{if $is_category_page == 1}
{literal}
javascript for your ads goes here
{/literal}
{/if}

Hope it helps!

zoomcreator

Re: Sidebar Advertisment Space (Except on Homepage)

Thank you for everyone's suggestions......the last one worked for me wink