Jump to content

arizanov

Members
  • Posts

    3
  • Joined

  • Last visited

arizanov's Achievements

Newbie

Newbie (2/6)

1

Reputation

  1. I turned on debugging on and it returned the username. Must have been some cache. Thanks for your help.
  2. Hmm. In my case createdUser property is a string, not a object of a class. The whole page class object looks like this: object(ProcessWire\Page)[215] public 'instanceID' public 'id' public 'name' (length=20) public 'path' (length=27) public 'status' (length=0) public 'template' (length=10) public 'parent' (length=6) public 'numChildren' public 'sort' public 'sortfield' (length=4) public 'created' (length=32) public 'modified' (length=32) public 'published' (length=32) public 'createdUser' (length=14) public 'modifiedUser' (length=14) public 'isLoaded' public 'outputFormatting' public 'hooks' array (size=12) 'before Page::render' (length=51) 'Page::render' (length=45) 'Page::editable' (length=53) 'Page::publishable' (length=56) 'Page::viewable' (length=53) 'Page::listable' (length=53) 'Page::deleteable' (length=55) 'Page::deletable' (length=55) 'Page::trashable' (length=54) 'Page::addable' (length=52) 'Page::moveable' (length=53) 'Page::sortable' (length=53) public 'data' array (size=2) 'title' (length=20) 'summary' (length=0)
  3. Hi guys. I am new to PW so I need some help. I can't figure out something basic here I think. I have the following code in the template file: namespace ProcessWire; $content = $page->body; $posts = $page->children("limit=10"); if(!empty($posts)): foreach($posts as $post): $content .= renderBlogItem($post); endforeach; else: $content .= "<h3>No articles found</h3>"; endif; $pagination = $posts->renderPager(); $content .= $pagination; And the following code in renderBlogItem function: function renderBlogItem($post){ return '<div class="item"> <h2> <a href="'.$post->url.'">'.$post->title.'</a></h2> <div>'. substr(strip_tags($post->body), 0, 375) .'...</div> <p><a href="'.$post->url.'">Read full story &gt;</a></p> <span>'.$post->createdUser.'</span> </div> '; } The issue is that fields are outputed differently from their actual values, for example for createdUser I have printed a number, for createdDate I have timestamp instead of the full date I have when I print the $post variable. What am I missing here ? Thanks.
×
×
  • Create New...