Ok, I understand now a little bit better how this works. I removed the context
so i simply call $theme->content($post); in the foreach loop. But this doesn't
solve the problem, it still display the same post five times. Is it possible
that there is an issue with reassigning the post in the $theme->content()
method? var_dump($posts) shows, that $posts contains the 5 Posts that should be
displayed. The output directly in the foreach loop also works pretty fine, but
if I use $theme->content() it doesn't work.
I attached the output of vardump.
object(Posts)#99 (5) {
[0]=>
object(Post)#77 (10) {
["tags:private"]=>
NULL
["comments_object:private"]=>
NULL
["author_object:private"]=>
NULL
["tokens:private"]=>
NULL
["inforecords:private"]=>
NULL
["url_args:protected"]=>
NULL
["fields:protected"]=>
array(12) {
["id"]=>
string(2) "23"
["slug"]=>
string(19) "rutrum-at-at-rutrum"
["title"]=>
string(19) "Rutrum At At Rutrum"
["guid"]=>
string(49) "tag:slog.site,2010:rutrum-at-at-rutrum/1283389929"
["content"]=>
string(971) "<a href="http://flickr.com/photos/28445...@n00/4948918372"
style="float:left;"><img
src="http://static.flickr.com/4083/4948918372_6ee7307564_m.jpg" alt="0801 Woody
at the door"></a>Sed vel lectus ullamcorper nec, erat. Maecenas sollicitudin
metus id velit lectus. Aenean id nonummy ac, nec bibendum odio risus
consectetuer adipiscing sit amet ante.
<ol>
<li>Tellus Metus</li>
<li>Molestie Lacinia Nec Nec</li>
<li>Erat Tristique</li>
<li>Vulputate Id Turpis Faucibus</li>
<li>Magna Molestie Urna Fringilla Aenean Pretium Volutpat</li>
</ol>
<ul>
<li>Enim Erat Amet Nec Ante Ante</li>
<li>Tristique Quis Tellus Nec Ut</li>
<li>Nibh Molestie Ac Lectus</li>
<li>Luctus Iaculis Ut Velit</li>
<li>Urna Odio</li>
<li>Vulputate Molestie Nonummy</li>
<li>Nec Sed Metus Bibendum Ac</li>
<li>Maecenas Sollicitudin Erat Leo Libero Egestas Sollicitudin</li>
<li>Molestie Nisl Rutrum</li>
<li>Odio Erat
Sed Rhoncus Phasellus Mauris Vulputate</li>
</ul>
"
["cached_content"]=>
string(0) ""
["user_id"]=>
string(1) "2"
["status"]=>
string(1) "2"
["pubdate"]=>
object(HabariDateTime)#78 (0) {
}
["updated"]=>
object(HabariDateTime)#79 (0) {
}
["modified"]=>
object(HabariDateTime)#80 (0) {
}
["content_type"]=>
string(1) "1"
}
["newfields:protected"]=>
array(0) {
}
["unsetfields:protected"]=>
array(1) {
["id"]=>
string(2) "id"
}
["properties_loaded:private"]=>
array(11) {
["id"]=>
bool(true)
["slug"]=>
bool(true)
["title"]=>
bool(true)
["guid"]=>
bool(true)
["content"]=>
bool(true)
["cached_content"]=>
bool(true)
["user_id"]=>
bool(true)
["pubdate"]=>
bool(true)
["updated"]=>
bool(true)
["modified"]=>
bool(true)
["content_type"]=>
bool(true)
}
}
[1]=>
object(Post)#83 (10) {
["tags:private"]=>
NULL
["comments_object:private"]=>
NULL
["author_object:private"]=>
NULL
["tokens:private"]=>
NULL
["inforecords:private"]=>
NULL
["url_args:protected"]=>
NULL
["fields:protected"]=>
array(12) {
["id"]=>
string(1) "1"
["slug"]=>
string(6) "habari"
["title"]=>
string(6) "Habari"
["guid"]=>
string(36) "tag:slog.site,2010:habari/1283379554"
["content"]=>
string(308) "Diese Site verwendet <a
href="http://habariproject.org/">Habari</a>, eine State-Of-The-Art Pubishing
Plattform. Habari ist ein Community nahes Projekt - erstellt und unterstützt
von Menschen aus aller Welt. Bitte besuche <a
href="http://habariproject.org/">http://habariproject.org/</a> um mehr zu
erfahren."
["cached_content"]=>
string(0) ""
["user_id"]=>
string(1) "1"
["status"]=>
string(1) "2"
["pubdate"]=>
object(HabariDateTime)#82 (0) {
}
["updated"]=>
object(HabariDateTime)#81 (0) {
}
["modified"]=>
object(HabariDateTime)#84 (0) {
}
["content_type"]=>
string(1) "1"
}
["newfields:protected"]=>
array(0) {
}
["unsetfields:protected"]=>
array(1) {
["id"]=>
string(2) "id"
}
["properties_loaded:private"]=>
array(11) {
["id"]=>
bool(true)
["slug"]=>
bool(true)
["title"]=>
bool(true)
["guid"]=>
bool(true)
["content"]=>
bool(true)
["cached_content"]=>
bool(true)
["user_id"]=>
bool(true)
["pubdate"]=>
bool(true)
["updated"]=>
bool(true)
["modified"]=>
bool(true)
["content_type"]=>
bool(true)
}
}
[2]=>
object(Post)#87 (10) {
["tags:private"]=>
NULL
["comments_object:private"]=>
NULL
["author_object:private"]=>
NULL
["tokens:private"]=>
NULL
["inforecords:private"]=>
NULL
["url_args:protected"]=>
NULL
["fields:protected"]=>
array(12) {
["id"]=>
string(1) "3"
["slug"]=>
string(33) "magna-nonummy-velit-velit-egestas"
["title"]=>
string(33) "Magna Nonummy Velit Velit Egestas"
["guid"]=>
string(63)
"tag:slog.site,2010:magna-nonummy-velit-velit-egestas/1283389889"
["content"]=>
string(1178) "<a href="http://flickr.com/photos/43334...@n00/4949175358"
style="display:block;"><img
src="http://static.flickr.com/4126/4949175358_e313127d01_m.jpg" alt="Ik heb
honger."></a>Nulla non porttitor ut, sit amet ante. Lorem ipsum dolor sit
amet, consectetuer adipiscing rutrum non, metus id velit pulvinar. Etiam
egestas rutrum non, nec bibendum odio risus malesuada. Proin in tellus tempus
molestie, volutpat.
<ol>
<li>Lacinia Molestie</li>
<li>Id Sit Quam Non Ipsum Amet Ut Magna</li>
<li>Sed Egestas</li>
<li>Erat Rutrum At Non Risus</li>
<li>Adipiscing Augue Lorem Vel</li>
</ol>
Mauris pretium nec bibendum odio risus pretium quam elit. Aenean id iaculis
quis, sem.
Vivamus luctus nec bibendum odio risus tempus molestie, sit amet ante. Aenean
id ullamcorper nec, erat libero tristique tellus, sed nisl molestie faucibus
fringilla. Etiam egestas sit amet nibh egestas leo. Nulla non sed nisl
molestie rutrum.
<ul>
<li>Sed Consectetuer Metus Metus Nonummy Pretium Volutpat Neque</li>
<li>Urna Urna Leo Egestas Urna</li>
<li>Augue Ut Ut Tempus Quam Vulputate</li>
<li>Tellus Proin Erat Iaculis</li>
<li>Iaculis Augue Sed Id Erat Libero</li>
</ul>
"
["cached_content"]=>
string(0) ""
["user_id"]=>
string(1) "2"
["status"]=>
string(1) "2"
["pubdate"]=>
object(HabariDateTime)#86 (0) {
}
["updated"]=>
object(HabariDateTime)#85 (0) {
}
["modified"]=>
object(HabariDateTime)#88 (0) {
}
["content_type"]=>
string(1) "1"
}
["newfields:protected"]=>
array(0) {
}
["unsetfields:protected"]=>
array(1) {
["id"]=>
string(2) "id"
}
["properties_loaded:private"]=>
array(11) {
["id"]=>
bool(true)
["slug"]=>
bool(true)
["title"]=>
bool(true)
["guid"]=>
bool(true)
["content"]=>
bool(true)
["cached_content"]=>
bool(true)
["user_id"]=>
bool(true)
["pubdate"]=>
bool(true)
["updated"]=>
bool(true)
["modified"]=>
bool(true)
["content_type"]=>
bool(true)
}
}
[3]=>
object(Post)#91 (10) {
["tags:private"]=>
NULL
["comments_object:private"]=>
NULL
["author_object:private"]=>
NULL
["tokens:private"]=>
NULL
["inforecords:private"]=>
NULL
["url_args:protected"]=>
NULL
["fields:protected"]=>
array(12) {
["id"]=>
string(2) "24"
["slug"]=>
string(21) "lectus-non-aenean-sit"
["title"]=>
string(21) "Lectus Non Aenean Sit"
["guid"]=>
string(51) "tag:slog.site,2010:lectus-non-aenean-sit/1283389929"
["content"]=>
string(380) "Etiam egestas ullamcorper nec, volutpat. Aenean id sed
nisl molestie ullamcorper nec, ullamcorper nec, pulvinar.
<ol>
<li>Pulvinar Metus Bibendum Turpis Augue</li>
<li>Volutpat Volutpat</li>
<li>Nec Ullamcorper Amet Nec Tempus Ullamcorper Quam Tellus</li>
</ol>
<ul>
<li>Magna At At Id Egestas</li>
<li>Pellentesque Volutpat</li>
<li>Adipiscing Molestie Sit</li>
</ul>
"
["cached_content"]=>
string(0) ""
["user_id"]=>
string(1) "2"
["status"]=>
string(1) "2"
["pubdate"]=>
object(HabariDateTime)#90 (0) {
}
["updated"]=>
object(HabariDateTime)#89 (0) {
}
["modified"]=>
object(HabariDateTime)#92 (0) {
}
["content_type"]=>
string(1) "1"
}
["newfields:protected"]=>
array(0) {
}
["unsetfields:protected"]=>
array(1) {
["id"]=>
string(2) "id"
}
["properties_loaded:private"]=>
array(11) {
["id"]=>
bool(true)
["slug"]=>
bool(true)
["title"]=>
bool(true)
["guid"]=>
bool(true)
["content"]=>
bool(true)
["cached_content"]=>
bool(true)
["user_id"]=>
bool(true)
["pubdate"]=>
bool(true)
["updated"]=>
bool(true)
["modified"]=>
bool(true)
["content_type"]=>
bool(true)
}
}
[4]=>
object(Post)#95 (10) {
["tags:private"]=>
NULL
["comments_object:private"]=>
NULL
["author_object:private"]=>
NULL
["tokens:private"]=>
NULL
["inforecords:private"]=>
NULL
["url_args:protected"]=>
NULL
["fields:protected"]=>
array(12) {
["id"]=>
string(1) "4"
["slug"]=>
string(45) "quis-ullamcorper-sed-lacinia-pretium-molestie"
["title"]=>
string(45) "Quis Ullamcorper Sed Lacinia Pretium Molestie"
["guid"]=>
string(75)
"tag:slog.site,2010:quis-ullamcorper-sed-lacinia-pretium-molestie/1283389889"
["content"]=>
string(646) "Vestibulum fermentum turpis at pulvinar vulputate,
ullamcorper nec, turpis at pulvinar vulputate, pulvinar. Etiam egestas
porttitor ut, tempus molestie, sed nisl molestie sem. Phasellus rhoncus augue
id magna porttitor ut, rutrum non, faucibus fringilla. Mauris pretium erat
libero tristique tellus, augue id magna lacinia neque malesuada. Nulla non
erat libero tristique tellus, pretium quam elit.
<a href="http://flickr.com/photos/97249...@n00/4949013056"
style="float:right;"><img
src="http://static.flickr.com/4088/4949013056_964dee81ba_m.jpg" alt="Cat on
chair (series)"></a>Integer malesuada erat libero tristique tellus, rutrum.
"
["cached_content"]=>
string(0) ""
["user_id"]=>
string(1) "2"
["status"]=>
string(1) "2"
["pubdate"]=>
object(HabariDateTime)#94 (0) {
}
["updated"]=>
object(HabariDateTime)#93 (0) {
}
["modified"]=>
object(HabariDateTime)#96 (0) {
}
["content_type"]=>
string(1) "1"
}
["newfields:protected"]=>
array(0) {
}
["unsetfields:protected"]=>
array(1) {
["id"]=>
string(2) "id"
}
["properties_loaded:private"]=>
array(11) {
["id"]=>
bool(true)
["slug"]=>
bool(true)
["title"]=>
bool(true)
["guid"]=>
bool(true)
["content"]=>
bool(true)
["cached_content"]=>
bool(true)
["user_id"]=>
bool(true)
["pubdate"]=>
bool(true)
["updated"]=>
bool(true)
["modified"]=>
bool(true)
["content_type"]=>
bool(true)
}
}
}
Am 17.09.2010 um 16:28 schrieb Owen Winkler:
> On 9/17/2010 9:26 AM, Thomas Schrader wrote:
>> Hello again,
>>
>> to clarify somethings of my previous post: The problem is that i always get
>> 5 times content of the first post of a page.
>> like in my previous post, my home.php looks like this:
>>
>> <?php foreach($posts as $post): ?>
>> <?php $theme->content($post, 'multiple'); ?>
>> <?php endforeach; ?>
>>
>> and I have a file "multiple.entry.php" which contains this for outputting
>> posts of type entry:
>>
>> <?php echo $post->title_out; ?>
>> <?php echo $post->content_out; ?>
>>
>> I think I do have a problem with the correct using of the
>> multiple.entry.php. Does anyone have an Idea where my mistake is?
>
> This is a kind of complicated issue, although I think I have an idea of why
> this is doing this.
>
> The 'multiple' argument to $theme->content($post, 'multiple') isn't a
> template name, it's a context.
>
> When you pass a context, the context is prefixed to the possible templates
> used to display the content. So if you pass multiple for an entry type post,
> you get a series of fallback templates that include:
>
> multiple.entry.php <-- context appended to content type
> multiple.post.php <-- context appended to class of variable
> entry.php <-- from the content type of the post
> post.php <-- from the class of the variable storing the post
> multiple.php <-- just the context
>
> Note that passing a context of "multiple" would cause Habari to look for a
> template that is normally used for displaying multiple posts, which might not
> be desirable.
>
> So what I think is happening is my passing "multiple" as the context
> argument, you're really telling Habari to display the multiple.php template,
> which normally would have the $posts variable it uses assigned internally
> from the request. Because it's being called through the content()
> pseudo-method on the Theme class, $post is getting reassigned to just the one
> post. Therefore, it's displaying the same post five times.
>
> Suffice to say that you should remove the context value from the call to
> $theme->content(), or change it to something Habari doesn't use internally.
>
> If doing that doesn't change your output drastically, then I'd next want to
> see what var_dump($posts) does just prior to your foreach loop in your
> home.php template.
>
> Hope that helps.
>
> Owen
>
>
> --
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/habari-users
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/habari-users