Support Forums

provide Modify Listing link on viewlisting page

This is a discussion on provide Modify Listing link on viewlisting page within the Technical Support forums, part of the Technical Support Forums category; I am trying to provide a link on the viewlisting.tpl to allow the owner of the listing to modify the ...


Go Back   68 Classifieds Forums > Technical Support Forums > Technical Support

This topic is resolved.

If you have a similar issue that this thread does not address, open a new related support topic.

 
Thread Tools Display Modes
Old 07-02-2009, 04:16 PM   #1
Customer
 
Join Date: Jun 2008
Location: Maldives
Posts: 134
Rep Power: 17
business is on a distinguished road
Default provide Modify Listing link on viewlisting page

I am trying to provide a link on the viewlisting.tpl to allow the owner of the listing to modify the listing.

Code:
{if $smarty.session.username=$username}<a href="/usermodifylisting.php?view={$view}">Modify Listing</a>{/if}
The idea is: when the owner of the listing is viewing it, we provide a link to Modify it.

But the above code does not work.. I get the following error:
Quote:
Fatal error: Smarty error: [in viewlisting2.tpl line 20]: syntax error: unidentified token '=' (Smarty_Compiler.class.php, line 1419) in /home/business/public_html/ibay.com.mv/includes/classes/smarty/Smarty.class.php on line 1092
what am i doing wrong? also, is there any risk in providing this feature.
thanks.
__________________
v 4.2.0 Developer - Default Template
business is offline  
Old 07-02-2009, 04:34 PM   #2
curmudgeon
 
Join Date: Mar 2006
Posts: 5,416
Rep Power: 139
Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light
Default

Smarty
__________________
Larry

Knowledge learned is more valuable than knowledge given.
Lhotch is offline  
Old 07-02-2009, 04:54 PM   #3
Customer
 
Join Date: Jun 2008
Location: Maldives
Posts: 134
Rep Power: 17
business is on a distinguished road
Default

i was able to do this:

Code:
{if "`$smarty.session.username`==`$username`"}<a href="/usermodifylisting.php?view={$view}">Modify Listing</a>{/if}
but the Modify Listing link is displayed on all listings pages... my thinking was display the link if the listing owner is equal to logged-in user.
__________________
v 4.2.0 Developer - Default Template
business is offline  
Old 07-02-2009, 04:57 PM   #4
curmudgeon
 
Join Date: Mar 2006
Posts: 5,416
Rep Power: 139
Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light
Default

Have you checked the contents of your variables to begin with?

In other words if you put the following in a template to se what they provide what do you get?

{$smarty.session.username}

{$username}
__________________
Larry

Knowledge learned is more valuable than knowledge given.
Lhotch is offline  
Old 07-02-2009, 05:10 PM   #5
Customer
 
Join Date: Jun 2008
Location: Maldives
Posts: 134
Rep Power: 17
business is on a distinguished road
Default

yes. I had already done that before I started writing the IF statement.

{$smarty.session.username} outputs the username of the logged-in user / current user

{$username} gives the username of the owner of the listing (i am using this in viewlisting2.tpl)


So, if the above two are equal/same, I am trying to put the Modify Listing link.
__________________
v 4.2.0 Developer - Default Template
business is offline  
Old 07-02-2009, 05:12 PM   #6
Staff
 
Join Date: Mar 2006
Location: New Jersey
Posts: 2,201
Rep Power: 71
John Snyder is a jewel in the rough
Default

Not sure why you are quoting and backticking stuff. So this doesn't work?

HTML Code:
{if $smarty.session.username == $username}
<a href="/usermodifylisting.php?view={$view}">Modify Listing</a>
{/if}
__________________
John
68C Staff

68C Downloads | Report a Bug | Knowledge Base
If you have a current support subscription, you can Submit a Support Ticket
John Snyder is offline  
Old 07-02-2009, 05:19 PM   #7
Customer
 
Join Date: Jun 2008
Location: Maldives
Posts: 134
Rep Power: 17
business is on a distinguished road
Default

works great.
i swear i tried the same syntax before and got error... maybe i missed something .. thanks to the two of you...
__________________
v 4.2.0 Developer - Default Template
business is offline  
Old 07-02-2009, 10:51 PM   #8
curmudgeon
 
Join Date: Mar 2006
Posts: 5,416
Rep Power: 139
Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light
Default

Quote:
Originally Posted by juven14 View Post
Not sure why you are quoting and backticking stuff. So this doesn't work?
from the smarty docs...

Quote:
Embedding Vars in Double Quotes

*

Smarty will recognize assigned variables embedded in "double quotes" so long as the variable name contains only numbers, letters, under_scores and brackets[]. See naming for more detail.
*

With any other characters, for example a .period or $object>reference, then the variable must be surrounded by `backticks`.
*

You cannot embed modifiers, they must always be applied outside of quotes.
Upon closer inspection of his original post however only has a single equal sign.
__________________
Larry

Knowledge learned is more valuable than knowledge given.
Lhotch is offline  
Old 07-04-2009, 12:00 PM   #9
Staff
 
Join Date: Mar 2006
Location: New Jersey
Posts: 2,201
Rep Power: 71
John Snyder is a jewel in the rough
Default

Thanks for the doc Larry, I was aware you could use quotes, just wasn't sure why he was using them in that instance as it wasn't necessary.
__________________
John
68C Staff

68C Downloads | Report a Bug | Knowledge Base
If you have a current support subscription, you can Submit a Support Ticket
John Snyder is offline  
Old 07-04-2009, 12:05 PM   #10
curmudgeon
 
Join Date: Mar 2006
Posts: 5,416
Rep Power: 139
Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light
Default

Quote:
Originally Posted by juven14 View Post
Thanks for the doc Larry, I was aware you could use quotes, just wasn't sure why he was using them in that instance as it wasn't necessary.
I missed the fact he only had a single equal sign when he first posted and thought it was a different issue when I posted the link.
__________________
Larry

Knowledge learned is more valuable than knowledge given.
Lhotch is offline  
Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
variable for listing id in viewlisting business Technical Support 2 06-22-2009 03:30 AM
"Upgrade" within modify a listing page.. YourPalAl Technical Support 0 06-14-2008 10:21 PM


All times are GMT -4. The time now is 04:41 AM.


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