Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/01/2012 in all areas

  1. In case the mistake I just made helps anyone else... I wanted to display a file on a page with a default install of PW. So I added a field of type 'file' and rather unimaginatively called it "Files". Via the admin I then edited a page and added a file and description to a page and added: foreach($page->files as $file) { echo "<p>Test output: {$file->description}</p>"; } to the template. The result was nothing new displayed :/ Confused I tried lots of things, then wondered if by using the name "Files" for my field I had stumbled on a reserved word that didn't work. Of course everyone will have seen my error, the field I added was "Files" and the field I am querying is "files". Lesson well and truly learned (I hope )
    1 point
  2. You can try something like this: $parents = $page->parents->slice(2); foreach($parents as $parent) { echo "<li><a href='{$parent->url}'>{$parent->title}</a>"; // only output ">" if not the last entry echo $parent->id != $parents->last()->id ? " > " : ""; echo "</li>"; }
    1 point
  3. I was thinking it would be good if it was something people could contribute to fairly easily. I'm sure that a lot of ProcessWire users here have accomplished a lot of really cool things inside of their templates using the API, and if there were a central place that they could then submit those for the benefit of others, that would save people having to re-invent the wheel or ask on the forums. Which leaves more time for Ryan and others to work on the core and various modules Some kind of basic gatekeeping/moderation would probably be necessary to ensure a minimum quality standard for the scripts.
    1 point
×
×
  • Create New...