Jump to content

antknight

Members
  • Posts

    126
  • Joined

  • Last visited

Everything posted by antknight

  1. Thanks Soma, and an explanation from Ryan from here
  2. In one of my sections' news pages, paginated list of news items: $results = $page->children("limit=3, sort=-date"); $pagination = $results->renderPager(); echo $pagination; echo "<ul class='nav'>"; foreach($results as $result) { echo "<li><p><a href='{$result->url}'>{$result->title}</a><br /><span class='summary'>{$result->date}</span></p></li>"; } echo "</ul>"; echo $pagination; In the sidebar (from head.inc), list the latest 5 news items from that section: $news = $page->rootParent->find("template=news-item, limit=5, sort=-date"); foreach ($news as $newsitem) { echo "<li><a href='{$newsitem->url}'>{$newsitem->title}</a></li>"; echo "<span>{$newsitem->date}</span>"; } On the first news page the sidebar displays correctly, when you go to page 2 I would expect the same five news items to be displayed. Instead the next five news items are displayed. Likewise for page 3, the next five news items are displayed. Why is this happening?
  3. Thanks Teppo it works! That is pretty slick that I can remove the if statement! I also wasn't aware that the order of selectors mattered, limit then sort or sort then limit, does it make a difference?
  4. Hi Guys, I have spent a fair amount of time trying to figure this out but I need some help. I have the following structure: Home --Section One ----News ------News Item --Section Two ----News ------News Item If I am on the home page I want to display a list of all the latest news items in the sidebar: if($page->path === '/') { $news = $pages->find("template=news-item, limit=5, sort=-date"); echo "<ul>"; foreach ($news as $newsitem) { echo "<li><a href='{$newsitem->url}'>{$newsitem->rootParent->title} - {$newsitem->title}</a></li>"; echo "<span>{$newsitem->date}</span>"; } echo "</ul>"; } If I am on any other page I want to display a list of all the latest news items FOR THAT SECTION in the sidebar, I can't figure it out
  5. This is very clever, I would never have been able to figure it out. Many Thanks Wanze!
  6. This should be an easy one! Currently in the default theme for sub-navigation is the following code: if($page->path != '/' && $page->rootParent->numChildren > 0) { echo "<ul id='subnav' class='nav'>"; foreach($page->rootParent->children as $child) { $class = $page === $child ? " class='on'" : ''; echo "<li><a$class href='{$child->url}'>{$child->title}</a></li>"; } echo "</ul>"; } Which works great for a structure like: Home -Cricket Club --News --About --Contact Class of 'on' is added to each of the news, about and contact pages when you are viewing them, but I want to go one more level. For example when viewing a child page of news, News link should still have class of 'on' applied. Even after studying this post I couldn't figure it out! How can I achieve this?
  7. Hi Pete, I tried that but as far as I can tell the permissions are not inherited? or if they are it very quickly becomes confusing where the permissions are defined. What is even more confusing is that here it talks about role inheritance in PAGES but makes no mention of TEMPLATES. Is that out of date? I think I might just stick with template based permissions.... This sounds like a good idea: here and here.
  8. Hello everyone! I am building a site for the local community. I want to be able to give each section of the community e.g. Parish Council, Cricket Club a section in the page tree they can edit. For example, when someone with the 'cricket-editor' role logs in they only view/edit the page Cricket Club and its children. How can I achieve this? I don't really want to have to create additional templates for each section just to define access. Although it won't be many templates, it just doesn't feel right. Home -Parish Council -News -About -Contact -Cricket Club -News -About -Contact etc... Thanks!
  9. This is a very handy module, thanks! How would I output an archive list in a template. For example a list of years and months and a link to a list of news items?
  10. I did think that so I tried this: $time = $_SERVER['REQUEST_TIME']; print date('Y-m-d H:i:s', $time); Is that correct? If so it returned the correct time.
  11. Output is as follows: date_default_timezone_set: Europe/London date.timezone: Europe/London
  12. I think that a radius search for the Map Marker field would be really useful.....that's as far as I got. Would anyone care to post up some super helpful snippets? I found some help here but I just don't know anywhere near enough to get it to work.
  13. Teppo, first if all, thanks for this super module! Just wondering about the login times. In my installation they show the server time (in Amsterdam). So in the UK, currently on GMT time, it shows GMT+1. Is there a way to correct this? I have set timezone to $config->timezone = 'Europe/London'; in config.php if that has anything to do with it?
  14. I simply want to hide 'Features' in the page tree because I think it will confuse the client, I still want them to be able to create new features using the AsmSelect. I will try your suggestion. Thanks!
  15. The situation I have a page in the page tree (Features) which is used to hold data for an AsmSelect field. I want to hide the 'Features' page in the page tree for the 'editor' role. AsmSelect in use: The problem Using the template access settings for the 'Features' and 'Feature' templates I am able to hide the 'Features' page in the page tree but the '+ Create New' link disappears. I have tried every combination of setting I can think of to no avail. Is this something that is supported?
  16. Have you tried leaving everything intact, and rather than clicking `check again' simply click 'continue to next step'? I get this same error on every install but just proceed anyway. The reason I think I get this error is because my server uses litespeed rather than apache and as it states:
  17. One thing that would be useful would be the ability to filter by page
  18. Amazing support once again. Here is the code I used for anyone interested: foreach($country->children() as $key => $dealer) { $class = ($key % 2 ? 'odd' : 'even'); $url = str_replace('http://', '', $dealer->website); echo "<tr class='$class' id='{$dealer->title}' name='{$dealer->title}' class='reviews-row1'><td><strong>{$dealer->title}</strong><br>{$dealer->map_marker->address}</td>"; echo "<td>{$dealer->telephone}</td>"; echo "<td>Website: <a href='{$dealer->website}' target='_blank'>{$url}</a><br>Email: <a href='mailto:{$dealer->email_address}'</a>{$dealer->email_address}</td>"; echo "</tr>"; }
  19. So you wouldn't recommended doing it within the PHP?
  20. Usually I would ask such a question on Stack Overflow but I thought it might benefit others using PW I would like each row of the table to have alternating colours (classes?) for better readability foreach($country->children() as $dealer) { $url = str_replace('http://', '', $dealer->website); echo "<tr id='{$dealer->title}' name='{$dealer->title}' class='reviews-row1'><td><strong>{$dealer->title}</strong><br>{$dealer->map_marker->address}</td>"; echo "<td>{$dealer->telephone}</td>"; echo "<td>Website: <a href='{$dealer->website}' target='_blank'>{$url}</a><br>Email: <a href='mailto:{$dealer->email_address}'</a>{$dealer->email_address}</td>"; echo "</tr>"; } I found a few answers here but once again it's my lack of knowledge of the syntax that is letting me down.Would anyone be kind enough to help me out?
×
×
  • Create New...