Jump to content

terry

Members
  • Posts

    3
  • Joined

  • Last visited

terry's Achievements

Newbie

Newbie (2/6)

2

Reputation

  1. Is there any built-in field that would return a page's index/sorted number? As far as I know what I'm looking for doesn't strictly fall under pagination (apologies if I'm incorrect about this). I currently have a parent page with n child pages, these are sorted by date (custom date field). e.g. Gamma (2014) Alpha (2013) Omega (2012) Beta (2011) So on page Gamma, I want to be able to return the int 1. Alpha, return int 2, Omega, return int 3, etc. (These would obviously change if the date field was modified). Is there any simple way to do this? Thanks. EDIT: Not sure if this was in the right forum. Managed to get it working, although there may be a simpler way, code for anyone interested: $a = $page->siblings('include=all'); foreach($a as $b) { $i++; if ($b == $page) { echo $i; } }
  2. Hey diogo, thanks for suggesting that. The child page template is now unhidden so ajax calls can be made, but throws a 404 if it wasn't requested via ajax. Like this: if($config->ajax) { content } else { throw new Wire404Exception(); }
  3. Pretty new to processwire and really enjoying it so far. I'm trying to build a pretty simple Ajax driven website (pretty new to me so excuse my general ignorance regarding ajax) which inserts content from child pages into a parent page. I've read through Ryan's thread here which was super helpful, but still can't quite figure out the best practices for what I'm trying to achieve. For now, all I'm trying to do is have the parent page load content from a child page with an ajax request, BUT these child pages also need to be inaccessible via the URL processwire creates for them. So the child pages are hidden via their template's access options. The /parent/ page successfully loads some initial content from these child pages using the "include=all" selector ( $pages->get("/parent/")->children('include=all'); ) as recommended in this thread. However as the child pages are hidden any ajax request to pull data from them results in a 404. If anyone can suggest the best practices for using processwire to create a site like this it would be a huge help. I assume that later I may have issues with linking/indexing by using this approach, but am happy to figure those out later.
×
×
  • Create New...