Nope - headLink, headTitle, headMeta, headScript, inlineScript and
headStyle all gather an array of elements, each of which only contains
the start, contents and end tags.
Each element uses the indent string only for child elements. Then the
final string is then resolved by joining them with the separator which
is currently just a line-end character.
In addition to this, setting the indent character alone won't resolve
the problem I'm trying to solve - if I have an indent set to 8 spaces,
the next 'tab stop' will be 16, 24, 32 etc... which is too much. I'd
like to start at a particular tab stop and then increment that via the
existing setIndent value.
Can I suggest the following change/addition to the API:-
public function setIndent($indent)
{
$this->_indent = $this->_getWhitespace($indent);
return $this;
}
public function setIndentLevel($level)
{
$this->_indentLevel = $this->_getWhitespace($position);
return $this;
}
protected function _getWhitespace($value)
{
if (is_int($value)) {
$value = str_repeat(' ', $value);
}
return (string) $value;
}
public function getIndentLevel()
{
return $this->_indentLevel;
}
public function toString()
{
...existing display logic per component...
return $this->_indentLevel . implode($this->getSeparator() .
$this->getIndentLevel(), $items);
}
On 18/12/2007, at 11:04 PM, Matthew Weier O'Phinney wrote:
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.
--
Simon Mundy | Director | PEPTOLAB
""" " "" """""" "" "" """"""" " "" """"" " """"" " """""" "" "
PeptoLab will be closed:
Saturday 15th December through until Monday 17th December
Saturday 22nd December through until Wednesday 2nd January
For urgent requests, please call 0438 046 061
202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000
Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654
4124
http://www.peptolab.com