Welcome Guest, Not a member yet? Register   Sign In
how to place some php decision code insite a template iteration
#1

[eluser]dvogel[/eluser]
I'm using the template parser for building my page from a template. The view is the real page content. I'm reading weblog items and placing them in the page using the following code

Code:
<div id="weblog">
    {weblog_records}
        <div class="entry">
            <div class="header">
                <div><a href="?/weblog/index/{id}">{title}</a></div>
                <div>door {name} {date}@{time}</div>
            </div>
            <div class="body">{message}</div>
        </div>
    {/weblog_records}
</div>

But i want the messages to be truncated. This will be done in the controller. The array containing the title, name, date, time and message gets a new variable messageTruncated which is true when the message was to long and was truncated. Within the {weblog_records}...{/weblog_records} iteration I want to check this boolean so I can place a html link to the complete message like this code:

Code:
&lt;?php
if ($messageTruncated == true)
{
    echo '<a href="?/weblog/index/{id}">read more...</a>''    
}
?&gt;

How can i access the variables within the current entry of the {weblog_records}...{/weblog_records} iteration?


Messages In This Thread
how to place some php decision code insite a template iteration - by El Forum - 01-16-2008, 05:49 AM



Theme © iAndrew 2016 - Forum software by © MyBB