Page 1 of 1
Content inside Content with smarty
Posted: Sat Apr 22, 2006 9:32 am
by tmhai
Hello,
Is it possible to use the 'assign' parameter in the {content} tag for the use of a smarty template? Im trying to add an image floating to the left on every page, and i dont want to have to edit each page seperately.
Re: Content inside Content with smarty
Posted: Sat Apr 22, 2006 4:26 pm
by jelle
I don't get your question? If all you want to do is have the same image in every page, edit your templates for that. If you need a different image, it might be simpler to just use a different template.
Re: Content inside Content with smarty
Posted: Sat Apr 22, 2006 4:29 pm
by calguy1000
if for example, your image name is encoded with your page name, then you can do something like: in your template.
use the get_template_vars plugin to find out exactly what the variable is.
Technically speaking, yes, you can place smarty code in your page or template, and use the assign stuff to do that no problem.
you may even be able to use the image plugin, like this: {image src={eval $pageid}} but I'd try it out.
Re: Content inside Content with smarty
Posted: Sun Apr 23, 2006 1:41 am
by tmhai
I have attached an example of what Im looking for.
[attachment deleted by admin]
Re: Content inside Content with smarty
Posted: Sun Apr 23, 2006 9:32 am
by jelle
Static content belongs in the template or in a html_blob/global content (that gets included in the template). Wrap a div around it and float it to where you want it.
But you've still not made clear to me why/if you want the image or content to be dynamically generated?
Btw Calguy: That method certainly has advantages (only one template to maintain, but wouldn't it confuse your endusers? As far as they are concerned, the template determines how the page looks. If you change a graphic dynamically, you break that assumption.
Re: Content inside Content with smarty
Posted: Sun Apr 23, 2006 2:48 pm
by calguy1000
I don't know, depending upon the content, and how many people are going to be editing content, putting this smarty syntax in the template could be very valid.
If you could manage to get this to work in the template, anybody writing a new page would simply have to upload an image of the proper resolution with a certain name to the images directory, whilst they were submitting content, and layout would automatically take place properly.
A global content block would definately make this syntax a little easier to understand, or a user defined plugin could go even further. then just put the tag into the template and, like you said, wrap a div around it, and off you go.
Re: Content inside Content with smarty
Posted: Mon Apr 24, 2006 3:31 am
by tmhai
Ok, I think were venturing into something else... let me fully re-explain.
I want to place a global content block next to the content of a page, rather than having two seperate coloums I want the content to wrap itself around the global block.
This is what I have in my template:
Code: Select all
<!-- Content Start -->
<div id="ad">{global_content name='Ad'}<div id="content">{content}</div></div>
<!-- Content End -->
This is the CSS:
Code: Select all
#content {
padding: 18px;
text-align: justify;
line-height: 1.4em;
background-image: url(image/shadow_content.gif);
background-repeat: repeat-x;
}
#ad {
float: right;
margin: 20px 10px 0 10px;
}
This is the global content block 'Ad':
Code: Select all
<__script__ type="text/javascript"><!--
google_ad_client = "pub-8235283052338144";
google_ad_width = 180;
google_ad_height = 60;
google_ad_format = "180x60_as_rimg";
google_cpa_choice = "CAAQ24Oy0QEaCGbgW7AaXRokKMu293M";
//--></__script>
<__script__ type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</__script>
With the above code the 'Ad' is wrapped, but it is wrapped in the top right hand corner. My question is how do I make it appear at the bottom right hand corner?
I have tried this, but it doesnt wrap:
Code: Select all
<!-- Content Start -->
<div id="content">{content}</div><div id="ad">{global_content name='Ad'}</div>
<!-- Content End -->