[Solar-talk] Composite views
Paul M Jones
pmjones at ciaweb.net
Sat Nov 3 08:00:12 CDT 2007
On Nov 2, 2007, at 11:12 PM, Robert Gonzalez wrote:
> Rodrigo Moraes wrote:
>> On Nov 2, 2007 1:51 PM, Robert Gonzalez wrote:
>>
>>> I apologize if this is too elementary of a question, but does
>>> anyone have
>>> any examples of how Solar would implement composite views?
>>>
>>
>> Are you thinking in something like components or so? Or...?
>>
>> -- rodrigo
>> _______________________________________________
>> Solar-talk mailing list
>> Solar-talk at lists.solarphp.com
>> http://mailman-mail3.webfaction.com/listinfo/solar-talk
>>
>>
> Sort of. I am thinking of ways to include other executable scripts
> into views. I was just wondering how Solar does it. In plain Jane
> code I am thinking of:
> <?php echo $this->header; ?>
> <?php include 'login_box.php'; ?>
> <div>.... blah blah ...</div>
2 ways to do this. You can "include" or "require" another view file
using $this->template(), which will search the template path stack
for you (including inherited templates).
<?php include $this->template('login_box.php'); ?>
As an alternative, you can use a partial and echo its results.
<?php echo $this->partial('login_box'); ?>
Be sure to read the docs on partials; they have some extra features
that make them particularly useful in loops.
<http://solarphp.com/class/Solar_View/partial()>
--
Paul M. Jones <http://paul-m-jones.com>
Solar: Simple Object Library and Application Repository
for PHP5. <http://solarphp.com>
Join the Solar community wiki! <http://solarphp.org>
Savant: The simple, elegant, and powerful solution for
templates in PHP. <http://phpsavant.com>
More information about the Solar-talk
mailing list