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
Member
 
Join Date: Jun 2008
Location: Maldives
Posts: 69
Rep Power: 7
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.1.3 Developer
business is offline  
Old 07-02-2009, 04:34 PM   #2
Coder
 
Join Date: Mar 2006
Posts: 4,742
Rep Power: 115
Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light
Default

Smarty
__________________
Larry
Lhotch is offline  
Old 07-02-2009, 04:54 PM   #3
Member
 
Join Date: Jun 2008
Location: Maldives
Posts: 69
Rep Power: 7
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.1.3 Developer
business is offline  
Old 07-02-2009, 04:57 PM   #4
Coder
 
Join Date: Mar 2006
Posts: 4,742
Rep Power: 115
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
Lhotch is offline  
Old 07-02-2009, 05:10 PM   #5
Member
 
Join Date: Jun 2008
Location: Maldives
Posts: 69
Rep Power: 7
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.1.3 Developer
business is offline  
Old 07-02-2009, 05:12 PM   #6
Moderator
 
juven14's Avatar
 
Join Date: Mar 2006
Location: Texas
Posts: 1,961
Rep Power: 57
juven14 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 Snyder
PHP Developer
juven14 is offline  
Old 07-02-2009, 05:19 PM   #7
Member
 
Join Date: Jun 2008
Location: Maldives
Posts: 69
Rep Power: 7
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.1.3 Developer
business is offline  
Old 07-02-2009, 10:51 PM   #8
Coder
 
Join Date: Mar 2006
Posts: 4,742
Rep Power: 115
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
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
Lhotch is offline  
Old 07-04-2009, 12:00 PM   #9
Moderator
 
juven14's Avatar
 
Join Date: Mar 2006
Location: Texas
Posts: 1,961
Rep Power: 57
juven14 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 Snyder
PHP Developer
juven14 is offline  
Old 07-04-2009, 12:05 PM   #10
Coder
 
Join Date: Mar 2006
Posts: 4,742
Rep Power: 115
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
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
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
Anchor text link in viewlisting.tpl SkGold v3.1 Modules & Modifications 4 04-11-2007 12:05 AM
http:// to be removed from link on viewlisting page marketingsolutions v3.1 Questions & Support 2 01-12-2007 06:36 PM


All times are GMT -4. The time now is 07:18 PM.


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