-- Simon Mundy <[EMAIL PROTECTED]> wrote
(on Tuesday, 18 December 2007, 06:05 PM +1100):
> I wanted to know if there could be the possibility for prepending the indent
> for the headXXX containers before the HTML tag?
> 
> Being a bit too precious about HTML output (!) I've set up pages so that they
> try and indent reasonably well based on content.
> 
> e.g.
> 
> <html>
> 
>     <head>
>         <title>...my title...</title>
> <?= $this->headScript() ?>
>     </head>
> ..etc...
> 
> If I have a <?= $this->headScript() ?> placed at the start of a line and it's
> empty, it produces no output (which is good).
> But if it does, the output starts at the 0 character mark of a line, rather
> than where I'd like it to start (e.g. 8 spaces in).
> 
> Could I be pedantic and request an indent value for the tag(s) for these
> containers if they're non-empty? Then the existing indent value could be added
> to this for all child elements.

I *believe* you can already do this in two ways: setting the indent
globally earlier, or passing it to toString() at output time:

    <?php $this->headScript()->setIndent(8); // indent 8 spaces
          $this->headScript()->setIndent('    '); // indent 4 spaces
    ?>


    <?= $this->headScript()->toString(8) ?>

Give that a try, and let me know if it works. Caveat: this will only
indent the actual tags, not the contents.

-- 
Matthew Weier O'Phinney
PHP Developer            | [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/

Reply via email to