Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Wrap output twice
I’m trying to figure out how to modify a plugin so that it wraps some results within another set of HTML tags.
Currently, the code says:
$out = $out ? doWrap($out, $wraptag, $break, $class) : '';
As the results are mostly a list, I would like to then wrap an additional div
around the entire results. This is mainly for styling purposes, as I’m using Bootstrap and want to use some of its alert styles.
So far, I have figure that two doWraps
one after the other doesn’t work eg.
$out = $out ? doWrap($out, $wraptag, $break, $class) : '';
$out2 = $out ? doWrap($out, $outertag, $outerbreak, $outerclass) : '';
… where $outertag
, $outerbreak
and $outerclass
are new attributes I have added to the tag.
I freely confess to just tinkering with the great work of others, and my PHP skills are pretty minimal. But I would like to get the HTML output to align with the needs of my CSS (whether Bootstrap or custom styles) and sometimes tinkering with the code is the only way.
Offline
Re: Wrap output twice
When you call doWrap($out, ...)
, $out
must be an array, but the returned value is a string, so your second call to doWrap()
fails. You could try to replace it with
$out2 = $out ? doWrap(array($out), $outertag, $outerbreak, $outerclass) : '';
Offline
Re: Wrap output twice
I did read the function for doWrap to try to understand what it did, and your explanation now helps me to make sense of it.
Thanks very much!
Offline
Pages: 1