Support Forums

adding ad photo to modify listing table

This is a discussion on adding ad photo to modify listing table within the Customizations forums, part of the Developer Forums category; Hey, I am trying to add a photo to the modifiy listing table on the user account. Basically I want ...


Go Back   68 Classifieds Forums > Developer Forums > Customizations

Reply
 
Thread Tools Display Modes
Old 05-08-2010, 10:12 PM   #1
Customer
 
Join Date: Feb 2010
Location: Montreal, QC
Posts: 285
Rep Power: 12
EnergyFreak is on a distinguished road
Default adding ad photo to modify listing table

Hey,

I am trying to add a photo to the modifiy listing table on the user account. Basically I want to add the ad photo to the current table. I have added this to create the table header:

Code:
<th>{$smarty.const.LANG_PHOTO}</th>
and so far no problem. But then when I add the actual code to go and get the photo from the database, it is not pulling anything, therefore it shows the nophoto.gif. But it should be pulling the actual photo since the ad does have a photo. This is the code I got from user favorites.tpl:

Code:
<td class="{cycle values="row1,row2" advance=false}"><a href="viewlisting.php?view={$entry.id}">{if $entry.image != ""}<img src="thumbs/small_{$entry.image}" />{else}<img src="images/nophotosmall.gif" border='0' />{/if}</a></td>
This is the full code for the userbrowselisting.tpl that I am working with:

Code:
<table class="main" width="100%">
	<tr>
		<th>{$smarty.const.LANG_PHOTO}</th>
        <th>{$smarty.const.LANG_TITLE}</th>
		<th>{$smarty.const.LANG_LISTING_ACTIVE}</th>
		<th>{$smarty.const.LANG_LISTING_EXPIRATION}</th>
		<th>{$smarty.const.LANG_LISTING_MODIFY}</th>
		<th>{$smarty.const.LANG_LISTING_DELETE}</th>
	</tr>
	{if $results}
		{foreach from=$results item="entry"}
		<tr>
		     <td class="{cycle values="row1,row2" advance=false}"><a href="viewlisting.php?view={$entry.id}">{if $entry.image != ""}<img src="thumbs/small_{$entry.image}" />{else}<img src="images/nophotosmall.gif" border='0' />{/if}</a></td>
             <td class="{cycle values="row1,row2" advance=false}">{$entry.title}</td>
		     <td class="{cycle values="row1,row2" advance=false}">
		      {if $entry.expirationTime < $smarty.now}
		     	{$smarty.const.LANG_EXPIRED}
		     {elseif $entry.display == "Y"}
		     	{$smarty.const.LANG_YES}
		     {elseif $entry.oStatus == 3}
		     	Pending Payment
		     {else}
		     	{$smarty.const.LANG_NO}
		     {/if}
		     </td>
		     <td class="{cycle values="row1,row2" advance=false}">
		     	{$entry.expiration|date_format:$dateformat}
		     	{if $entry.oStatus == 3 || $entry.oStatus==4}
		     	 
		     	{elseif $entry.renew}
		     		<br /><a href="userrenew.php?action=renew&listingid={$entry.id}&orderid={$entry.orderID}">{$smarty.const.LANG_LISTING_CLICK_TO_RENEW}</a>
		     	{else}
		     		<br /><a href="userrenew.php?action=renew&listingid={$entry.id}&orderid={$entry.orderID}">{$smarty.const.LANG_LISTING_UPGRADE}</a>
		     	{/if}
		     </td>
		     {if $entry.oStatus==3 || $entry.oStatus==4}
		     <td class="{cycle values="row1,row2" advance=false}"><input type="button" value="{$smarty.const.LANG_MAKE_PAYMENT}" onClick="MM_goToURL('parent','usercheckout.php?step=6&listingid={$entry.id}&productid={$entry.oProductID}');return document.MM_returnValue" /></td>
		     {else}
		     <td class="{cycle values="row1,row2" advance=false}"><input type="button" value="{$smarty.const.LANG_LISTING_MODIFY}" onClick="MM_goToURL('parent','usermodifylisting.php?view={$entry.id}');return document.MM_returnValue" /></td>
		     {/if}
		     <td class="{cycle values="row1,row2" advance=true}"><input type="button" value="{$smarty.const.LANG_LISTING_DELETE}" onClick="delrec('{$entry.id}')" /></td>
		</tr>
A supplied screenshot is attached to this post.
Attached Images
File Type: png phototest.png (28.6 KB, 4 views)
EnergyFreak is offline   Reply With Quote
Old 05-08-2010, 11:31 PM   #2
Developer & Moderator
 
 
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 2,311
Rep Power: 69
Mike-N-Tosh is just really nice Mike-N-Tosh is just really nice
Default

Try using the smarty {debug} to get the actual variables that are assigned to the template that you are working with. You need to understand that the variables assigned to any given template may be different and many times are different for the individual template files. You are using a variable that obviously isn't assigned to the template that you are working in.

An FYI: to see what variables are given to any template or displayed page, place "{debug}" at the very top above everything else in the layout.tpl file of the template that you are using. Make sure that you turn off any pop up window blocker that you may have. If you are using the SEO module, you will also need to de-activate it. This built in smarty function will then pop up a separate window displaying all available variables for any page that you visit as well as which template file and script file is in use.
__________________
Mike-N-Tosh
IndianaPC.org - A community website (v3.1.10 Developer - heavily modified & used as the CMS)
Sandbox [localhost(v3.1.10, v4.0.9, 4.1.10,4.2,5.0)] for development and customization
Visit My blog: reviews, tips, tricks, tutorials and my store with Templates, Mods & Docs
Web Hosting | Web Design & Development | 68 Classifieds Customizations
I am not a 68C employee, just a user and try to help out
Mike-N-Tosh is offline   Reply With Quote
Old 05-09-2010, 12:04 PM   #3
Customer
 
Join Date: Feb 2010
Location: Montreal, QC
Posts: 285
Rep Power: 12
EnergyFreak is on a distinguished road
Default

This functions pulls the pictures from the database right?

Code:
{$entry.id}
How can this differ from a template from another? I am using purple template and when I used debug on layout.tpl this is what I got:

Code:
SELECT title AS sitetitle, email, url, urls, keywords, description, version, mainTemplate, adminTemplate, notify,mainIndexCols,mainCatCols,mainSubCols,mainTakeOffline,mainTakeOfflineReason,mainEmailValidation,smtp,smtpHost,smtpUsername,smtpPassword,smtpPort,mailHTML,htmlEditor,removeTime,showTotal,template_title,template_logo FROM class_admin WHERE id=1
SELECT cCurrencySymbol, cCurrencyDecimal, cCurrencyDecimalPlaces, cCurrencyThousands, cCurrencyAfter, cDateFormat, cAdminDateFormat, cLanguage, cAdminLanguage FROM class_currency_settings WHERE cID=1
SELECT name, directory FROM class_modules WHERE state=3 ORDER BY mOrder, displayname
SELECT * FROM class_users WHERE (username = '') AND (cookie = '') AND level=1
I do not see how this can help me. I just want to pull the current ad picture from the database and show it as a thumbnail. Any other hints would be greatly appreciated.
EnergyFreak is offline   Reply With Quote
Old 05-09-2010, 04:29 PM   #4
Developer & Moderator
 
 
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 2,311
Rep Power: 69
Mike-N-Tosh is just really nice Mike-N-Tosh is just really nice
Default

You need to read the instructions for using the smarty {debug} as I posted, NOT the debug module. Those are completely different things! Furthermore {entry.ID} is NOT a function. It is a variable that is assigned to a template by a function. Functions are the processes used in the script, or the php. Which again I covered in my post. Any given function can assign a variable to a template, which is why and how it can and does vary from template to template.

So when you actually use the smarty {debug} it will then give you a list of every single variable that is assigned to the template as well as other information which WILL give you the exact item that you are looking for.

If you need further information regarding Smarty and the debug then please visit the online documentation for 68 Classifieds and/or visit the official smarty website.
__________________
Mike-N-Tosh
IndianaPC.org - A community website (v3.1.10 Developer - heavily modified & used as the CMS)
Sandbox [localhost(v3.1.10, v4.0.9, 4.1.10,4.2,5.0)] for development and customization
Visit My blog: reviews, tips, tricks, tutorials and my store with Templates, Mods & Docs
Web Hosting | Web Design & Development | 68 Classifieds Customizations
I am not a 68C employee, just a user and try to help out
Mike-N-Tosh is offline   Reply With Quote
Old 05-11-2010, 08:02 PM   #5
Customer
 
Join Date: Feb 2010
Location: Montreal, QC
Posts: 285
Rep Power: 12
EnergyFreak is on a distinguished road
Default

I finally figured how to use smarty function to debug my template, but I am still clueless as which variable pulls the ad photos from the database. This is what I got.

PHP Code:
Smarty Debug Console
included templates 
config files (load time in seconds)
no templates included
assigned template variables
{$SCRIPT_NAME}    "/index.php"
{$allowedTags}    "<b><strong><p>"
{$body}    "home.tpl"
{$canSaveFavorites}    "Y"
{$checkoutDisDesc}    "Y"
{$checkoutDisPrice}    "Y"
{$checkoutDisShortDesc}    "Y"
{$checkoutDisURL}    "Y"
{$checkoutManuallyApprove}    "N"
{$checkoutModifyStatus}    "N"
{$checkoutNotification}    "Y"
{$checkoutRequireDesc}    "N"
{$checkoutRequirePrice}    "Y"
{$checkoutRequireShortDesc}    "N"
{$cols}    "2"
{$currency_symbol}    "�"
{$data}    Array (1)
=> Array (11)
  
id => "1"
  
parent_id => "0"
  
name => "test"
  
slug => "test"
  
description => ""
  
image => "templates/purple/images/folder.gif"
  
allowads => "Y"
  
cLink => ""
  
start_link => "<a href="category.php?cat=test" title..."
  
subcats => ""
  
total => "7"
{$dateformat}    "%B %e, %Y"
{$headtitle}    "68 Classifieds"
{$lastDate}    "2010-05-12"
{$newpms}    null
{$pPageContent}    "<div style="background-color:#ffc709;..."
{$pmon}    "Y"
{$querycounter}    12
{$queryhistory}    Array (12)
=> "SELECT title AS sitetitle, email, url..."
=> "SELECT cCurrencySymbol, cCurrencyDeci..."
=> "SELECT name, directory FROM class_mod..."
=> "SELECT turnedon, max FROM class_setti..."
=> "SELECT uBanned,uAllowContact,uAllowEm..."
=> "SELECT pageID, pPageTitle, pURI FROM ..."
=> "SELECT checkoutNotification,checkoutM..."
=> "SELECT pPageContent FROM class_pages ..."
=> "SELECT id,parent_id,name,slug,descrip..."
=> "SELECT id,name,slug,image,cLink FROM ..."
10 => "SELECT id FROM class_categories WHERE..."
11 => "SELECT COUNT(*) AS size FROM class_li..."
{$renewal}    "Y"
{$renewalDays}    "7"
{$script_name}    "index.php"
{$sitedescription}    "Your site description"
{$sitekeywords}    "keywords, go, here"
{$sitetitle}    "68 Classifieds"
{$tc_jcarousel}    "on"
{$template_description}    "Your site description"
{$template_logo}    ""
{$template_title}    "68 Classifieds"
{$templatecodes}    "on"
{$templatepages}    Array (0)
{
$title}    "68 Classifieds"
assigned config file variables (outer template scope)
{
#files#}    Array (0)
{#vars#}    Array (0) 
EnergyFreak is offline   Reply With Quote
Old 05-11-2010, 08:40 PM   #6
Developer & Moderator
 
 
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 2,311
Rep Power: 69
Mike-N-Tosh is just really nice Mike-N-Tosh is just really nice
Default

You need to look at the smarty window for the template page you want the variables for. You posted the smarty window from your home page. Notice how it says script name /index.php and body is home.tpl? You said you were wanting to add the photo on the users account page. Visit that page with the {debug} active to see the variables for that page.
__________________
Mike-N-Tosh
IndianaPC.org - A community website (v3.1.10 Developer - heavily modified & used as the CMS)
Sandbox [localhost(v3.1.10, v4.0.9, 4.1.10,4.2,5.0)] for development and customization
Visit My blog: reviews, tips, tricks, tutorials and my store with Templates, Mods & Docs
Web Hosting | Web Design & Development | 68 Classifieds Customizations
I am not a 68C employee, just a user and try to help out
Mike-N-Tosh is offline   Reply With Quote
Old 05-11-2010, 09:28 PM   #7
Customer
 
Join Date: Feb 2010
Location: Montreal, QC
Posts: 285
Rep Power: 12
EnergyFreak is on a distinguished road
Default

Quote:
Originally Posted by Mike-N-Tosh
You need to look at the smarty window for the template page you want the variables for. You posted the smarty window from your home page. Notice how it says script name /index.php and body is home.tpl? You said you were wanting to add the photo on the users account page. Visit that page with the {debug} active to see the variables for that page.
Oh okay thanks. This is what I found on new ads page where there are ads with photos under the {$results}

PHP Code:
Array (7)
=> Array (30)
  
id => "10"
  
owner => "1"
  
title => "tetststs"
  
featured => "N"
  
section => "1"
  
shortDescription => "test"
  
description => "ttast"
  
price => "123.00"
  
dateadded => "2010-05-09 03:47:55"
  
expiration => "2011-05-19 03:47:55"
  
display => "Y"
  
pHighlighted => "N"
  
pBold => "N"
  
hitcount => "2"
  
url => ""
  
username => "*****"
  
state => "none"
  
city => "Belmont"
  
country => "Afghanistan"
  
extra => "test"
  
extra2 => "test"
  
extra3 => "test"
  
sTitle => ""
  
sDescription => ""
  
sImage => ""
  
status => "Y"
  
image => "despicable_me_111680x1050.jpg"
  
class => ""
  
link => "viewlisting.php?view=10"
  
custom => "" 
I believe it might be the "sImage" what would I do with this variable?

Last edited by EnergyFreak; 05-11-2010 at 09:31 PM.
EnergyFreak is offline   Reply With Quote
Old 05-12-2010, 04:08 AM   #8
All Hands On Deck
 
 
Join Date: Mar 2008
Posts: 3,342
Rep Power: 84
seymourjames is a jewel in the rough
Default

It says simage variable appears to be empty.

Just take the main image entry.image and scale it with your thumbnail dimensions.
__________________
"The fool doth think he is wise, but the wise man knows himself to be a fool.".

TemplateCodes.com for 68C, Version 4 Templates & Modules
Get the Best U.S Hosting, Best U.K Hosting
seymourjames is offline   Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Photo Display in Show Listing boots Templates, HTML, CSS, and Design Help 4 02-04-2010 08:30 AM
feature listing horizontal table problems magicosta Technical Support 0 06-06-2009 05:23 PM
Lost styling because of adding table bowers01 Technical Support 23 09-16-2008 09:31 PM
Adding Feature Item Table to HTML Page art Templates, HTML, CSS, and Design Help 11 08-05-2006 03:10 AM


All times are GMT -4. The time now is 11:12 AM.


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