Support Forums

Just a couple of Qs about certain smarty code?

This is a discussion on Just a couple of Qs about certain smarty code? within the Templates, HTML, CSS, and Design Help forums, part of the General category; the best tool you can ever use is the debug console. Add {debug} to the top of the layout.tpl file ...


Go Back   68 Classifieds Forums > General > Templates, HTML, CSS, and Design Help

Reply
 
Thread Tools Display Modes
Old 08-18-2010, 09:23 AM   #11
Genius At Work
 
bowers01's Avatar
 
Join Date: May 2008
Location: Geelong, Victoria, Australia
Posts: 1,057
Rep Power: 31
bowers01 is on a distinguished road
Default

the best tool you can ever use is the debug console.

Add {debug} to the top of the layout.tpl file and it will show what variables are avaliable for each page.

Nick
__________________
Nick Bowers
68c v4.1.10 Developer Custom Template
bowers01 is offline   Reply With Quote
Old 08-18-2010, 09:26 AM   #12
Customer
 
Join Date: Aug 2010
Posts: 77
Rep Power: 2
T0m1 is on a distinguished road
Default

Hi Nick,

Already done it hence {$firstname} can only be used on usermodify pages lol.

And username is obviously stored in the session data

Actually there is very little you can call ont he main page from the debug console. Which is strange.

Many thanks for replying,
__________________
Tom.

68c Developer v4.1.10 - Very Custom Template
MySQL v5.0.91-community <-> PHP v5.2.13 <-> Apache v2.2.15

Experience is the name we give to our mistakes
T0m1 is offline   Reply With Quote
Old 08-18-2010, 09:27 AM   #13
curmudgeon
 
Join Date: Mar 2006
Posts: 5,291
Rep Power: 130
Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light
Default

php variables get assigned to the templates and in turn are accessable as smarty variables. You can see what smarty variables are available on any given page by invoking the smarty debug console as highlighted here...

Templates Guide - 68 Classifieds

The logged in users actual name doesnt really need to be known by the system so its not recalled and stored in the session. It would just create a lot of bloat for people who have no nead for it.

That being said, if the users first name is not available to you on any given page you have a couple options,

Create a plugin to get it based on their userid, which is a valid session variable. You can learn about creating a plugin here...

Template Plugins - 68 Classifieds

It would basically add another database call everytime a page is loaded, which depending on traffi could be quite a bit overhead with no real purpose.

The other option would be to modify the login process to collect the usrs first name and add it to the session. This would be a claner approach and wouldnt add the extra overhead of a database call on each page to get the users name. The downside is that you would need the developer version and if you ever upgraded your site you would need to make the same code mods to the newly updated site as well.

The last option would be to make use of a module. Im not even sure if a hook exists, but if it does a module could check the database at login time and add the firstname to the session as well. This is more complex than altering core code but would be external to the core code so unaffected by site upgrades.
__________________
Larry

Knowledge learned is more valuable than knowledge given.
Lhotch is offline   Reply With Quote
Old 08-18-2010, 12:19 PM   #14
Customer
 
Join Date: Aug 2010
Posts: 77
Rep Power: 2
T0m1 is on a distinguished road
Default

Hi Larry,

Sounds like every worst nightmare for me seeing as im just starting. I like the idea of easy,but not redo with each update. I like the idea of do once work always, but not the "Complex" factor as for killing the database...

I guess the first bit to do is see if Eric can confirm if a 'hook' ? exists for the module route (not that I know what im doing ).
Then some rather ackward planning from there...

Many thanks for the help guys
__________________
Tom.

68c Developer v4.1.10 - Very Custom Template
MySQL v5.0.91-community <-> PHP v5.2.13 <-> Apache v2.2.15

Experience is the name we give to our mistakes
T0m1 is offline   Reply With Quote
Old 08-18-2010, 12:22 PM   #15
curmudgeon
 
Join Date: Mar 2006
Posts: 5,291
Rep Power: 130
Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light
Default

I took a quick look through the code and idnt see a hook forsucessful login and I also dont see one in the docs....

Module Hooks - 68 Classifieds

I placed a requst to have one added for future releases but that doesnt help you now.
__________________
Larry

Knowledge learned is more valuable than knowledge given.
Lhotch is offline   Reply With Quote
Old 08-18-2010, 12:35 PM   #16
Customer
 
Join Date: Aug 2010
Posts: 77
Rep Power: 2
T0m1 is on a distinguished road
Default

Hi Larry,

Many thanks for that. I could further future use (obviously not from a developers point of view but from the view of where first, and last names would come into play).

Well back to modding my site (template wise).

Many thanks,
__________________
Tom.

68c Developer v4.1.10 - Very Custom Template
MySQL v5.0.91-community <-> PHP v5.2.13 <-> Apache v2.2.15

Experience is the name we give to our mistakes
T0m1 is offline   Reply With Quote
Old 08-18-2010, 12:43 PM   #17
curmudgeon
 
Join Date: Mar 2006
Posts: 5,291
Rep Power: 130
Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light
Default

Tom, a word of advice. Dont get bogged down with the little things. craigslist is a perfect example of function over form. It works and is heavily used but it looks horrible and in my opinion is not even very user friend.

With that in mind, place your focus on marketing and practicality. Dont waste time or energy on bells and whistles, they can always be aded later. Day in and day out we see people on this forum spending countless hours on these small inconsequential tweaks that have no real bearing on the success of their site. Focus your efforts where it matters and that is on functionality and marketting. All the little niceities can easily be added once the site takes off or is often the case you realize they dont need to be added at all.
__________________
Larry

Knowledge learned is more valuable than knowledge given.
Lhotch is offline   Reply With Quote
Old 08-18-2010, 01:08 PM   #18
Customer
 
Join Date: Aug 2010
Posts: 77
Rep Power: 2
T0m1 is on a distinguished road
Default

Hi Larry,

I totally agree that certain things can be left without needing a tweak. For me a nice look and feel is important though, especially when the people you speak to are heavily addicted to facebook.

Currently we have a group on facebook which has in excess of 4000 members (well thats spread across 3 groups) and this since only May.
But fb is far from ideal and it is a nightmare when it gets busy, which was half the reason behind me moving to a dedicated web application. There are some big obstacles for me to overcome, 1 being luring people away from fb .No matter how useless it is for this kind of thing people are stubborn and think it caters for their every need without ever needing another site again...

This is how far ive gotten so far. Its not that far along, but hey (image below).
Attached Images
File Type: jpg class_demo.jpg (299.0 KB, 7 views)
__________________
Tom.

68c Developer v4.1.10 - Very Custom Template
MySQL v5.0.91-community <-> PHP v5.2.13 <-> Apache v2.2.15

Experience is the name we give to our mistakes
T0m1 is offline   Reply With Quote
Old 08-19-2010, 03:06 PM   #19
Customer
 
Join Date: Aug 2010
Posts: 77
Rep Power: 2
T0m1 is on a distinguished road
Default

Hi Guys,

Just another quick question here. When you list an itema nd Bold, Highlight and Featured are enabled you get the extras box at the bottom.
When you have the values set to 0 for said option it defaults to yes. So using the current code (below)
Code:
{if $allowFeatured=="Y"}
<p>
<label for="featured">{$smarty.const.LANG_ADD_FEATURED}{$smarty.const.LANG_COLON}</label>
<select name="featured" id="featured">
<option value="N">{$smarty.const.LANG_NO_THANKS}</option>
<option value="Y"{if $cFeaturedPrice=="0"} SELECTED{/if}>{$smarty.const.LANG_YES} (+{$cFeaturedPrice|format_money})</option>
</select>
</p>
{/if}
Could I alter it to hide the selection boxes whilst still have the choice default to yes? Like this

Code:
{if not $cFeaturedPrice=="0"}
{if $allowFeatured=="Y"}
<p>
<label for="featured">{$smarty.const.LANG_ADD_FEATURED}{$smarty.const.LANG_COLON}</label>
<select name="featured" id="featured">
<option value="N">{$smarty.const.LANG_NO_THANKS}</option>
<option value="Y"{if $cFeaturedPrice=="0"} SELECTED{/if}>{$smarty.const.LANG_YES} (+{$cFeaturedPrice|format_money})</option>
</select>
</p>
{/if}
{/if}
Does anyone see a better way ?

*** EDIT ***

Ok scratch that idea. Ive tried it and yes it does hide the option, but the negative effect is that the option is not applied to the listing so its like its basically disabled.

I am open to offers

Many thanks,
__________________
Tom.

68c Developer v4.1.10 - Very Custom Template
MySQL v5.0.91-community <-> PHP v5.2.13 <-> Apache v2.2.15

Experience is the name we give to our mistakes

Last edited by T0m1; 08-19-2010 at 03:47 PM.
T0m1 is offline   Reply With Quote
Old 08-19-2010, 03:53 PM   #20
All Hands On Deck
 
 
Join Date: Mar 2008
Posts: 2,834
Rep Power: 69
seymourjames is a jewel in the rough
Default

Tom - you are probably better off starting a new thread rather than tacking onto this one. Also, I am not really following what you are trying to do. What is the goal? What extras box - are you in checkout?
__________________
"The fool doth think he is wise, but the wise man knows himself to be a fool.".

TemplateCodes.com for 68 Classifieds
seymourjames is offline   Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
A couple of questions Unregistered Pre Sales Questions 4 07-10-2009 09:35 PM
Smarty {if} code not always showing up in some browers? forumosa Technical Support 3 10-11-2008 03:01 AM
A couple of questions Unregistered Pre Sales Questions 7 10-11-2006 09:08 PM


All times are GMT -4. The time now is 11:16 PM.


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