Page 1 of 1
Page_Image tag dump shows null
Posted: Mon Feb 23, 2009 7:26 pm
by SolaMia
I am trying to add a conditional page image with this new {page_image} tag. The problem is that I can't seem to get any if statements to work. I did a {get_template_vars} dump but I see nothing that I can use in my if statement.
Example:
Code: Select all
{if $page_image==""}
<br><br><img src="uploads/images/{page_image thumbnail="yes"}" width="150px">
{else}
{/if}
If I do a {dump item='page_image'} I get null even on pages that have it set and shows the image.
Any ideas?
I did get this ugly thing to work:
Code: Select all
{literal}
<__script__ type="text/javascript">
var pageimage = '{/literal}{page_image thumbnail="yes"}';
{literal}
if (pageimage > '')
{
document.write('<br><br><img src="uploads/images/{/literal}{page_image thumbnail="yes"}{literal}" width="150px">')
}
</__script>{/literal}
Re: Page_Image tag dump shows null
Posted: Mon Jun 29, 2009 6:28 pm
by bryan
I ran into this very problem today while attempting to override my stylesheet to use {page_image} in my #header-graphic. I tried using both {if} and {capture} methods without success. After drilling down with {debug} I found that I could use this method:
Code: Select all
{if $content_obj->mProperties->mPropertyValues.image != ''}
{literal}
<style>
#header-graphic {
background-image:url(uploads/images/{/literal}{page_image}{literal});
}
</style>
{/literal}
{/if}
You can use the same method to conditionally display your thumbnail: (UNTESTED)
Code: Select all
{if $content_obj->mProperties->mPropertyValues.thumbnail==""}
<br /><br /><img src="uploads/images/{page_image thumbnail="yes"}" width="150px" />
{else}
{/if}
Re: Page_Image tag dump shows null
Posted: Wed Aug 05, 2009 2:30 am
by corinteractive.com
I was not able to get this to work. I wanted a solution to show a default header if the page had none set for Image for {page_image}.... Or when say a new page was created and the client did not set the image in the options tab...
Help?
It shows this when the page is rendered
Code: Select all
<style>
#header-graphic {
background-image:url(uploads/images/);
width: 550px;
height: 104px;
border-bottom-width: 5px;
border-bottom-style: solid;
border-bottom-color: #FFFF00;
}
</style>
Code in template:
Code: Select all
{if $content_obj->mProperties->mPropertyValues.image != ' '}
{literal}
<style>
#header-graphic {
background-image:url(uploads/images/{/literal}{page_image}{literal});
width: 550px;
height: 104px;
border-bottom-width: 5px;
border-bottom-style: solid;
border-bottom-color: #FFFF00;
}
</style>
{/literal}
{else}
<style>
#header-graphic {
background-image:url(uploads/images/header-inn.jpg);
width: 550px;
height: 104px;
border-bottom-width: 5px;
border-bottom-style: solid;
border-bottom-color: #FFFF00;
}
</style>
{/if}
Re: Page_Image tag dump shows null
Posted: Wed Aug 05, 2009 6:21 pm
by Dr.CSS
One thing for sure once you wrap something in {literal} you don't need to do it again inside the {literal} like you have for the image call...
Maybe this helps?...
http://mit-computers.com/index.php/how- ... types.html
Re: Page_Image tag dump shows null
Posted: Tue Aug 11, 2009 5:20 pm
by bryan
It looks like you have a space in your if statement:
Code: Select all
{if $content_obj->mProperties->mPropertyValues.image != ' '}
Try removing the space between the single quotes ( '' not ' ' )
Re: Page_Image tag dump shows null
Posted: Tue Aug 11, 2009 8:28 pm
by corinteractive.com
Tried both ways still did not work.
Re: Page_Image tag dump shows null
Posted: Tue Aug 11, 2009 10:55 pm
by Dr.CSS
You can't use content image in css, that is a smarty call and css doesn't use smarty, put it in the template but not as a css call...
Re: Page_Image tag dump shows null
Posted: Tue Aug 11, 2009 10:58 pm
by corinteractive.com
this was put in the template not in the css file.
Code: Select all
{if $content_obj->mProperties->mPropertyValues.image != ''}
{literal}
<style>
#header-graphic {
background-image:url(uploads/images/{/literal}{page_image}{literal});
width: 550px;
height: 104px;
border-bottom-width: 5px;
border-bottom-style: solid;
border-bottom-color: #FFFF00;
}
</style>
{/literal}
{else}
<style>
#header-graphic {
background-image:url(uploads/images/header-inn.jpg);
width: 550px;
height: 104px;
border-bottom-width: 5px;
border-bottom-style: solid;
border-bottom-color: #FFFF00;
}
</style>
{/if}
Re: Page_Image tag dump shows null
Posted: Tue Aug 11, 2009 11:01 pm
by Dr.CSS
That is still using css to call it as in background: bla bla bla note the call above it...