Support Forums

Old 12-30-2007, 10:16 AM   #1
Junior Member
 
Join Date: Dec 2007
Posts: 15
Rep Power: 6
nachtwerkmir is on a distinguished road
Default Adsense code in viewlisting.php

Hi, does anyone know how to correcty insert an google adsensecode in the viewlisting.php?

I would like to see the adsense code between the table with the ad and the table were the user can contact the seller.
nachtwerkmir is offline   Reply With Quote
Old 12-30-2007, 06:08 PM   #2
civ
Senior Member
 
civ's Avatar
 
Join Date: Mar 2006
Location: Greer, SC
Posts: 670
Rep Power: 27
civ will become famous soon enough
Default

Add it wherever you want it in viewlisting.tpl.php
__________________
Civ's Modules (____NOW v4 COMPATIBLE____):

� Stop Incomplete Listings! (proven revenue booster!)
� Scam Filter (Just say no to Nigerians!) updated
� Similar Listings (keep visitors longer)
� Feedback Mod (testimonial builder)
� Listing Status Reminder free!
civ is offline   Reply With Quote
Old 01-01-2008, 10:34 AM   #3
Junior Member
 
Join Date: Dec 2007
Posts: 15
Rep Power: 6
nachtwerkmir is on a distinguished road
Default doesn't work

It doesn't matter where i put it, i always get a error like:
Parse error: parse error, unexpected '}' in /var/www/html/test/viewlisting.php on line 154

or whatever line i insert the script. I've inserted the adsensecode with and without the {/literal} tags. I would really insert the code between the ad and the part where the user can contact the seller.
This is how i tried it last:

<?php
/*
* 68 Classifieds
*
* All source code & content (c) Copyright 2006, 68 Classifieds
* unless specifically noted otherwise.
*
* @Author $Author: Blair $ (68 Classifieds)
* @copyright 68 Classifieds
* @link http://www.68classifieds.com
* @version 3.1
* @$Revision: 1.7 $
* @Updated: $Date: 2007/05/10 16:31:30 $
* @package 68 Classifieds
*
*/
require_once('includes/init.php');
require_once('includes/classes/kernel/Listings.php');
$Listing = new Listings( $db, $class_tpl );

$go=TRUE;
if (!empty($_GET['view']))
{
$view = (int)$_GET['view'];
if(!$Listing->getListing($view))
{
$go=FALSE;
}
else
{
$rs=$Listing->getListing($view);
}
}
else
{
$go=FALSE;
}
if($go==FALSE)
{
//no rows where found. Must be either expired or deleted. Lets show the not available page
//header("Location: search.php");
$class_tpl->assign('available', FALSE);
$class_tpl->assign('body','viewlisting/notavailable.tpl.php');
}
else
{
if($rs['display']=="Y")
{
$price=FormatCurrency($rs['price']);
}
else
{
$price=LANG_LISTING_PRICE_SOLD;
}
//assign variables
$modules->call_hook('view_listing', $view); // Call any module functions
$path=breadcrumb($rs['section'],0);
$class_tpl->assign('breadcrumb', $path);
$title= safeStripSlashes($title ." : ". $rs['title']);
$class_tpl->assign('available', TRUE);
$class_tpl->assign('title', $title);

//owner
$class_tpl->assign('ownerid', safeStripSlashes($rs['owner']));
$class_tpl->assign('ownername', safeStripSlashes($rs['username']));
$class_tpl->assign('owneraddress', safeStripSlashes($rs['address']));
$class_tpl->assign('ownercity', safeStripSlashes($rs['city']));
$class_tpl->assign('ownerstate', safeStripSlashes($rs['state']));
$class_tpl->assign('ownercountry', safeStripSlashes($rs['country']));
$class_tpl->assign('ownerzip', safeStripSlashes($rs['zip']));
$class_tpl->assign('ownerphone', $rs['phone']);

//listing
$class_tpl->assign('listingid', $rs['id']);
$class_tpl->assign('url', $rs['url']);
$class_tpl->assign('listingtitle', safeStripSlashes($rs['title']));
$class_tpl->assign('listingsection', $rs['section']);
$class_tpl->assign('listingprice', $price);
$class_tpl->assign('dateadded', $rs['dateadded']);
$class_tpl->assign('listingexpiration', $rs['expiration']);
$class_tpl->assign('listingviews', $rs['hitcount']);
$class_tpl->assign('shortdescription', nl2br(safeStripSlashes($rs['shortDescription'])));
$class_tpl->assign('description', nl2br(safeStripSlashes($rs['description'])));
$class_tpl->assign('display', $rs['display']);

//extra fields
$extra=array();
$sSQL = "SELECT f.fID,sValue FROM ".PREFIX."products_fields AS p, `".PREFIX."fields` AS f WHERE p.pID='".$view."' AND f.fSeen='Y' AND p.fID=f.fID ORDER BY f.fOrder ASC";
$result=$db->query($sSQL);
$i=0;
while ($rs=$result->fetch())
{
$sql="SELECT fID,fName,fType FROM `".PREFIX."fields` WHERE fID='".$rs['fID']."' AND fSeen='Y' ORDER BY fOrder ASC";
$result2=$db->query($sql);
$rs2=$result2->fetch();
if(strpos($rs['sValue'], "|"))
{
$rs['sValue'] = explode("|", $rs['sValue']);
}
if($rs2['fType']=="F")
{
$ext = substr(strrchr($rs['sValue'], "."), 1);
if($ext=="pdf")
{
$icon='<img src="images/icon_pdf.png" />';
}
elseif($ext=="zip")
{
$icon='<img src="images/icon_zip.png" />';
}
else
{
$icon='<img src="images/icon_page.png" />';
}
$rs['sValue']=$icon." <a href=\"uploads/".$rs['sValue']."\" target=\"_blank\">".$rs['sValue']."</a>";
}
$tmp = array(
'fID' => $rs['fID'],
'title' => $rs2['fName'],
'value'=> nl2br($rs['sValue']),
);
$extra[$i++] = $tmp;
$i++;
}
$class_tpl->assign('extra', $extra);

//get the images
$image=$Listing->getImages($view);
$class_tpl->assign('data', $image);

//get the display fields
$sSQL="SELECT lDisplay,lCols FROM ".PREFIX."listing_settings WHERE lID=1";
$result=$db->query($sSQL);
$rs=$result->fetch();
$lDisplay=$rs['lDisplay'];

$class_tpl->assign('canSaveFavorites', $canSaveFavorites);
$class_tpl->assign('viewphotos', $canViewPhotos);
$class_tpl->assign('viewseller', $canViewSeller);
$class_tpl->assign('viewaddress', $canViewAddress);
$class_tpl->assign('viewcity', $canViewCity);
$class_tpl->assign('viewstate', $canViewState);
$class_tpl->assign('viewcountry', $canViewCountry);
$class_tpl->assign('viewprice', $canViewPrice);
$class_tpl->assign('viewdate', $canViewDateAdded);
$class_tpl->assign('viewexpiration', $canViewExpiration);
$class_tpl->assign('viewhits', $canViewHits);
$class_tpl->assign('viewphone', $canViewPhone);
$class_tpl->assign('cols', $rs['lCols']);

$class_tpl->assign('allowcontact', $canContact);
$class_tpl->assign('allowfriendmail', $canEmailFriend);
$result->freeResult($result);
{literal}
<script type="text/javascript"><!--
google_ad_client = "pub-122322323232";
google_ad_width = 336;
google_ad_height = 280;
google_ad_format = "336x280_as";
google_ad_type = "text_image";
google_ad_channel ="";
google_page_url = document.location;
google_color_border = "FFFFDD";
google_color_bg = "FFFFDD";
google_color_link = "000000";
google_color_url = "FF6600";
google_color_text = "000000";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
{/literal}
//catpcha?
$sSQL="SELECT rCaptcha FROM ".PREFIX."registration WHERE rID=1";
$result=$db->query($sSQL);
$rs=$result->fetch();
$rCaptcha=$rs['rCaptcha'];
$class_tpl->assign('rCaptcha', $rCaptcha);

if($lDisplay==1)
{
$class_tpl->assign('body','viewlisting.tpl.php');
}
else
{
$class_tpl->assign('body','viewlisting2.tpl.php');
}

//finally update the hit counter
$sSQL = "UPDATE ".PREFIX."products SET hitcount=hitcount+1 WHERE id=".$view;
$db->query($sSQL);
}

//now display the template
$class_tpl->display('layout.tpl.php', $view);
?>
nachtwerkmir is offline   Reply With Quote
Old 01-01-2008, 10:36 AM   #4
Junior Member
 
Join Date: Dec 2007
Posts: 15
Rep Power: 6
nachtwerkmir is on a distinguished road
Default doesn't work

Well it doesn't seem to work. Is still get a parse error. I have tried it with and without the {/literal} tags. I would like to have the code just between the ad en the space where the user can contact the seller. This is the code with the parseerror.

<?php
/*
* 68 Classifieds
*
* All source code & content (c) Copyright 2006, 68 Classifieds
* unless specifically noted otherwise.
*
* @Author $Author: Blair $ (68 Classifieds)
* @copyright 68 Classifieds
* @link http://www.68classifieds.com
* @version 3.1
* @$Revision: 1.7 $
* @Updated: $Date: 2007/05/10 16:31:30 $
* @package 68 Classifieds
*
*/
require_once('includes/init.php');
require_once('includes/classes/kernel/Listings.php');
$Listing = new Listings( $db, $class_tpl );

$go=TRUE;
if (!empty($_GET['view']))
{
$view = (int)$_GET['view'];
if(!$Listing->getListing($view))
{
$go=FALSE;
}
else
{
$rs=$Listing->getListing($view);
}
}
else
{
$go=FALSE;
}
if($go==FALSE)
{
//no rows where found. Must be either expired or deleted. Lets show the not available page
//header("Location: search.php");
$class_tpl->assign('available', FALSE);
$class_tpl->assign('body','viewlisting/notavailable.tpl.php');
}
else
{
if($rs['display']=="Y")
{
$price=FormatCurrency($rs['price']);
}
else
{
$price=LANG_LISTING_PRICE_SOLD;
}
//assign variables
$modules->call_hook('view_listing', $view); // Call any module functions
$path=breadcrumb($rs['section'],0);
$class_tpl->assign('breadcrumb', $path);
$title= safeStripSlashes($title ." : ". $rs['title']);
$class_tpl->assign('available', TRUE);
$class_tpl->assign('title', $title);

//owner
$class_tpl->assign('ownerid', safeStripSlashes($rs['owner']));
$class_tpl->assign('ownername', safeStripSlashes($rs['username']));
$class_tpl->assign('owneraddress', safeStripSlashes($rs['address']));
$class_tpl->assign('ownercity', safeStripSlashes($rs['city']));
$class_tpl->assign('ownerstate', safeStripSlashes($rs['state']));
$class_tpl->assign('ownercountry', safeStripSlashes($rs['country']));
$class_tpl->assign('ownerzip', safeStripSlashes($rs['zip']));
$class_tpl->assign('ownerphone', $rs['phone']);

//listing
$class_tpl->assign('listingid', $rs['id']);
$class_tpl->assign('url', $rs['url']);
$class_tpl->assign('listingtitle', safeStripSlashes($rs['title']));
$class_tpl->assign('listingsection', $rs['section']);
$class_tpl->assign('listingprice', $price);
$class_tpl->assign('dateadded', $rs['dateadded']);
$class_tpl->assign('listingexpiration', $rs['expiration']);
$class_tpl->assign('listingviews', $rs['hitcount']);
$class_tpl->assign('shortdescription', nl2br(safeStripSlashes($rs['shortDescription'])));
$class_tpl->assign('description', nl2br(safeStripSlashes($rs['description'])));
$class_tpl->assign('display', $rs['display']);

//extra fields
$extra=array();
$sSQL = "SELECT f.fID,sValue FROM ".PREFIX."products_fields AS p, `".PREFIX."fields` AS f WHERE p.pID='".$view."' AND f.fSeen='Y' AND p.fID=f.fID ORDER BY f.fOrder ASC";
$result=$db->query($sSQL);
$i=0;
while ($rs=$result->fetch())
{
$sql="SELECT fID,fName,fType FROM `".PREFIX."fields` WHERE fID='".$rs['fID']."' AND fSeen='Y' ORDER BY fOrder ASC";
$result2=$db->query($sql);
$rs2=$result2->fetch();
if(strpos($rs['sValue'], "|"))
{
$rs['sValue'] = explode("|", $rs['sValue']);
}
if($rs2['fType']=="F")
{
$ext = substr(strrchr($rs['sValue'], "."), 1);
if($ext=="pdf")
{
$icon='<img src="images/icon_pdf.png" />';
}
elseif($ext=="zip")
{
$icon='<img src="images/icon_zip.png" />';
}
else
{
$icon='<img src="images/icon_page.png" />';
}
$rs['sValue']=$icon." <a href=\"uploads/".$rs['sValue']."\" target=\"_blank\">".$rs['sValue']."</a>";
}
$tmp = array(
'fID' => $rs['fID'],
'title' => $rs2['fName'],
'value'=> nl2br($rs['sValue']),
);
$extra[$i++] = $tmp;
$i++;
}
$class_tpl->assign('extra', $extra);

//get the images
$image=$Listing->getImages($view);
$class_tpl->assign('data', $image);

//get the display fields
$sSQL="SELECT lDisplay,lCols FROM ".PREFIX."listing_settings WHERE lID=1";
$result=$db->query($sSQL);
$rs=$result->fetch();
$lDisplay=$rs['lDisplay'];

$class_tpl->assign('canSaveFavorites', $canSaveFavorites);
$class_tpl->assign('viewphotos', $canViewPhotos);
$class_tpl->assign('viewseller', $canViewSeller);
$class_tpl->assign('viewaddress', $canViewAddress);
$class_tpl->assign('viewcity', $canViewCity);
$class_tpl->assign('viewstate', $canViewState);
$class_tpl->assign('viewcountry', $canViewCountry);
$class_tpl->assign('viewprice', $canViewPrice);
$class_tpl->assign('viewdate', $canViewDateAdded);
$class_tpl->assign('viewexpiration', $canViewExpiration);
$class_tpl->assign('viewhits', $canViewHits);
$class_tpl->assign('viewphone', $canViewPhone);
$class_tpl->assign('cols', $rs['lCols']);

$class_tpl->assign('allowcontact', $canContact);
$class_tpl->assign('allowfriendmail', $canEmailFriend);
$result->freeResult($result);
{literal}
<script type="text/javascript"><!--
google_ad_client = "pub-heredoiputmyid";
google_ad_width = 336;
google_ad_height = 280;
google_ad_format = "336x280_as";
google_ad_type = "text_image";
google_ad_channel ="";
google_page_url = document.location;
google_color_border = "FFFFDD";
google_color_bg = "FFFFDD";
google_color_link = "000000";
google_color_url = "FF6600";
google_color_text = "000000";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
{/literal}
//catpcha?
$sSQL="SELECT rCaptcha FROM ".PREFIX."registration WHERE rID=1";
$result=$db->query($sSQL);
$rs=$result->fetch();
$rCaptcha=$rs['rCaptcha'];
$class_tpl->assign('rCaptcha', $rCaptcha);

if($lDisplay==1)
{
$class_tpl->assign('body','viewlisting.tpl.php');
}
else
{
$class_tpl->assign('body','viewlisting2.tpl.php');
}

//finally update the hit counter
$sSQL = "UPDATE ".PREFIX."products SET hitcount=hitcount+1 WHERE id=".$view;
$db->query($sSQL);
}

//now display the template
$class_tpl->display('layout.tpl.php', $view);
?>

Last edited by nachtwerkmir; 01-01-2008 at 10:39 AM.
nachtwerkmir is offline   Reply With Quote
Old 01-01-2008, 11:46 AM   #5
Moderator
 
 
Join Date: Mar 2006
Posts: 4,318
Rep Power: 106
Lhotch is just really niceLhotch is just really nice
Default

You need to place it in the template, not the script itself. You also need to surround the code with proper smarty escape tags.
__________________
Larry.
(Please note: I am not a 68C employee. I am a customer and volunteer who helps with questions where I can and the forums spam free)

Set your site apart from the competition with one of my modules......
Google Map Module | You Tube Module | Google Calendar Module | Event Calendar Module

68 Classifieds Important Links
Customer Area | Issue Tracker | Knowledge Base | User Manuals
Lhotch is offline   Reply With Quote
Old 01-01-2008, 12:41 PM   #6
civ
Senior Member
 
civ's Avatar
 
Join Date: Mar 2006
Location: Greer, SC
Posts: 670
Rep Power: 27
civ will become famous soon enough
Default Template...

Quote:
Originally Posted by civ View Post
Add it wherever you want it in viewlisting.tpl.php
Yep, take another look at the bolded portion of my previous reply
__________________
Civ's Modules (____NOW v4 COMPATIBLE____):

� Stop Incomplete Listings! (proven revenue booster!)
� Scam Filter (Just say no to Nigerians!) updated
� Similar Listings (keep visitors longer)
� Feedback Mod (testimonial builder)
� Listing Status Reminder free!
civ is offline   Reply With Quote
Old 01-01-2008, 12:54 PM   #7
Junior Member
 
Join Date: Dec 2007
Posts: 15
Rep Power: 6
nachtwerkmir is on a distinguished road
Default smarty escape tags

Wrong file!! i see.
But what are the correct smarty escape tags? I am not familiar with the tags.
nachtwerkmir is offline   Reply With Quote
Old 01-01-2008, 01:21 PM   #8
Moderator
 
 
Join Date: Mar 2006
Posts: 4,318
Rep Power: 106
Lhotch is just really niceLhotch is just really nice
Default

http://www.smarty.net/manual/en/language.escaping.php
__________________
Larry.
(Please note: I am not a 68C employee. I am a customer and volunteer who helps with questions where I can and the forums spam free)

Set your site apart from the competition with one of my modules......
Google Map Module | You Tube Module | Google Calendar Module | Event Calendar Module

68 Classifieds Important Links
Customer Area | Issue Tracker | Knowledge Base | User Manuals
Lhotch is offline   Reply With Quote
Old 01-03-2008, 01:44 AM   #9
Junior Member
 
Join Date: Dec 2007
Posts: 15
Rep Power: 6
nachtwerkmir is on a distinguished road
Default solved

Thanks, solved!
nachtwerkmir is offline   Reply With Quote

Bookmarks

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

BB 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
Embed YouTube code problems brw9532 v3.1 Questions & Support 4 09-29-2007 10:25 AM
Registration Code MADKing v3.1 Questions & Support 5 08-12-2007 03:35 AM
I need a little help please darek v3.1 Modules & Modifications 6 04-06-2007 09:28 AM
Adding Adsense. Baz v3.1 Questions & Support 10 12-13-2006 04:51 PM
Postal Code Search Mod GSP v3.1 Questions & Support 0 05-15-2006 03:52 PM


All times are GMT -4. The time now is 09:30 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0