Created
April 23, 2013 12:00
-
-
Save sorenmalling/5443008 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
renderObj = COA | |
renderObj { | |
wrap = <ul>|</ul> | |
1 = TEXT | |
1 { | |
wrap = <li>|</li> | |
typolink { | |
parameter.field = link | |
} | |
field = title | |
} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Using | |
$this->cObj->cObjGetSingle($this->conf[$endpoint . '.']['renderObj'], $this->conf[$endpoint . '.']['renderObj.']); | |
outputs | |
<ul> | |
<li> | |
<a href="..." >Element 1</a> | |
</li> | |
</ul> | |
<ul> | |
<li> | |
<a href="..." >Element 2</a> | |
</li> | |
</ul> | |
would like | |
<ul> | |
<li> | |
<a href="..." >Element 1</a> | |
</li> | |
<li> | |
<a href="..." >Element 2</a> | |
</li> | |
</ul> |
I will be creating a <ul><li></li></ul>
list with data from a external service (Disqus)
$response = json_decode($disqusService->request());
foreach ($response->response as $response) {
$this->cObj->data = get_object_vars($response);
$content .= $this->cObj->cObjGetSingle($this->conf[$endpoint . '.']['renderObj'], $this->conf[$endpoint . '.']['renderObj.']);
}
If i move the wrap part on level up, example:
[endpoint name] {
render {
wrap = <ul>|<ul>
renderObj {
[like above]
}
}
}
How do I code-wise apply the <ul>
(wrap) correctly
I'd do it this way:
$content .= $this->cObj->wrap($this->cObj->cObjGetSingle($this->conf[$endpoint . '.']['renderObj'], $this->conf[$endpoint . '.']['renderObj.']), '
- |
Something like:
[endpoint name] {
stdWrap.wrap = <ul>|<ul>
renderObj {
[like above]
}
}
$response = json_decode($disqusService->request());
$listcontent = '';
foreach ($response->response as $response) {
$this->cObj->data = get_object_vars($response);
$listcontent .= $this->cObj->cObjGetSingle($this->conf[$endpoint . '.']['renderObj'], $this->conf[$endpoint . '.']['renderObj.']);
}
$listcontent = $this->cObj->stdWrap($listcontent, $this->conf[$endpoint . '.']['stdWrap.']);
$content .= $listcontent;
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
the wrap should no be inside renderObj. I can't suggest a solution because I don't really get the context by the code you provided. Either way the ul wrap has to be "one level above".