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; Hi Guys (I did warn you ). Just been looking throught eh default template and deep red or deep sea. ...


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

Reply
 
Thread Tools Display Modes
Old 08-16-2010, 12:20 PM   #1
Customer
 
Join Date: Aug 2010
Posts: 100
Rep Power: 7
T0m1 is on a distinguished road
Default Just a couple of Qs about certain smarty code?

Hi Guys
(I did warn you ).

Just been looking throught eh default template and deep red or deep sea. I also read Mikes blog post on working with templates in v4.1.x (very well written by the way).

There are a couple of things that are left unanswered (for me) though.
I am looking at the default template and im wondering if I can use my existing layout (as I have a site that this will be part of) use the main layout.tpl for the index code and plonk the smarty in at the relevant places. The css and images I can just copy over (is what im guessing lolol).

But like the left hand side navigation I can see this

Code:
<!-- // Left Side // -->
						{* Left side navigation.*}
						{dynamic}
						<div id="sidebar">
							<h1>{$smarty.const.LANG_MEMBER_NAVIGATION}</h1>
							<div class="left-box">
								<ul class="sidemenu">
									{if $smarty.session.username<>'' || $smarty.cookies.username<>""}
Firstly, is the <!-- //Left Side//--> text needed? I know its for commenting, but I have encountered systems where it is a must else it wont render diddly :s

Then we have {*Left side.......*} . Again is this required? or is it another form of commenting?

Then what does {dynamic} do? and is it needed only round links? round every smarty tag there is?

Sorry about this, im trying to learn php (only just begun) so im trying to take a bit in lol.

Regards,
__________________
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-16-2010 at 12:27 PM.
T0m1 is offline   Reply With Quote
Old 08-16-2010, 12:26 PM   #2
curmudgeon
 
Join Date: Mar 2006
Posts: 5,413
Rep Power: 138
Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light
Default

Im not sure I am totally following the question/s. Can you use your own layout? sure you can BUT if you want it to display the contents of your classifieds your going to have to put the smarty constants and variables into it.

What you really need to do is simply spend some time to learn what smarty IS and what it does by reading at Smarty : Template Engine

Everything in curly braces represents either a smarty constant or a smarty variable. If you do not have that in your template, the data passed from the underlying script into that constant or variable will not exist.
__________________
Larry

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

Hi,

Many thanks for the super quick response

I do understand that the smarty constants need to be put in, but what I was trying to establish was
firstly is the <!-- //Left Side// --> purely for commenting? its not used to place info anywhere or to let the system know to render left side info there?

Also {* Left side navigation.*}

This looks like a comment with the spaces etc. But as you pointed out everything inside of curly brackets is a smarty variable or constant so what does this do and how does it limit me in my layout?

Lastly {dynamic}

Is this only used on menus relating to user accounts, all menu items or everything content?

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-16-2010, 01:01 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

Tom,

First, thanks for your kind comments about my blog article.
Quote:
Originally Posted by T0m1
... I was trying to establish was firstly is the <!-- //Left Side// --> purely for commenting?
Yes, this is strictly commenting

Quote:
Originally Posted by T0m1
Also {* Left side navigation.*}
Ditto, this is commenting for "Smarty". One difference of Smarty comments are they won't even show when a user views the source code of the web page. Smarty doesn't send it's comments to the HTML source.

Quote:
Originally Posted by T0m1
Lastly {dynamic}
That's more "syntax" then anything else, I don't believe it's actually required.
__________________
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 08-16-2010, 01:12 PM   #5
curmudgeon
 
Join Date: Mar 2006
Posts: 5,413
Rep Power: 138
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 Mike-N-Tosh
That's more "syntax" then anything else, I don't believe it's actually required.
The smarty {dymanic} tag controls if a section of code is cached.

Smarty
__________________
Larry

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

Hi Mike and Larry

Ahh that does make it clearer

So the smarty comments can say anything which is cool.
The dynamic syntax then is used to show dynamic content so it isn't caches is this right? Or the opposite way round?

This should help me a fair bit I'll show you guys my look one complete or partially working at least.

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-16-2010, 01:28 PM   #7
curmudgeon
 
Join Date: Mar 2006
Posts: 5,413
Rep Power: 138
Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light
Default

what is in between dynamic tags wont be cached is how I understand it.
__________________
Larry

Knowledge learned is more valuable than knowledge given.
Lhotch is offline   Reply With Quote
Old 08-16-2010, 01:33 PM   #8
curmudgeon
 
Join Date: Mar 2006
Posts: 5,413
Rep Power: 138
Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light
Default

Also, dont be afraid to experiment. In the time it took you to post in this thread you could have deleted the coments you were asking about yourself and determined first hand what the ramifications where.

Just make sure to keep an unmolested copy of the default templates so you have something to go back to if one gets mucked up. Its also a good idea to delete the contents of the /templates_c folder after making some changes. It contains the cached files and removing them will force smarty to rebuild them so you can be sure your template changes are in deed included if what you see.
__________________
Larry

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

Hi Larry

I shall have a play when I get back in and should hopefully have a half working template running.

There are other questions I already have but these are best until I've got the look working, plus they are more code related than HTML lol.

Many thanks again
__________________
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:12 AM   #10
Customer
 
Join Date: Aug 2010
Posts: 100
Rep Power: 7
T0m1 is on a distinguished road
Default

Hi again guys,

I have a further question now although it could easily be placed in a new thread, why waste the space lol.

Ok here goes. By default ever template uses a certain bit of smarty code which always welcomes a user by their username. Id like to do things a tiny bit different. Instead of Welcome 'Username' I would prefer to do the following;
Welcome back, $firstname (Username)

So here is my code so far
was
Code:
{dynamic}
{if $smarty.session.username<>'' || $smarty.cookies.username<>""}
{$smarty.const.LANG_USER_WELCOME} {$smarty.session.username}
{if $pmon=="Y"}........
My poor attempt
Code:
{dynamic}
{if $smarty.session.username<>" || $smarty.cookies.username<>""}
{$smarty.const.LANG_USER_WELCOME}, {?} ( {$smarty.session.username} )
Ok I havent changed much lol. But you would have thought that you could use alternate welcomes. On the account modify page you have the {$firstname} but there are no other normal pages this shows on.

Then I thought, aha {$smarty.session.firstname} but hang on, firstname doesnt have a session, its the username.

Any ideas anyone?

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
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 12:30 AM.


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