Jump to content

antknight

Members
  • Posts

    126
  • Joined

  • Last visited

Everything posted by antknight

  1. @diogo Is there anything like that? I like the idea of using a VPS rather than shared hosting. The only thing that gets me is using terminal to set everything up, you can't get an overview of what is installed and if I did something wrong I would have no idea how to fix it.
  2. I made use of prependTemplateFile in config.php for the last site I made, should config.php be included when using the export site profile?
  3. Thanks! A lot to look through but I am sure I will get there!
  4. I'm glad it's not something I have done wrong, setting up a web server is no easy task. Well, this helps a lot but still, why can't it be simple? Buy some hosting. Put website on hosting. Type in domain name you want to use. Type in email addresses you want to use. Go to homepage...it works! Simple
  5. Why is it that when I install PW locally on MAMP the site-default folder is renamed automatically to site and file permissions are set correctly but when i install on Linode I have to manually rename site-default and adjust file permissions? Something to do with my server set up?
  6. OK guys this one has me thinking. I have an events section which is where all events site-wide are put. I have given people the ability to assign their event to a particular section of the site using pageListSelect. On the front end, the events page lists all events regardless of the section they have been assigned to: <?php $today = strtotime(date("Y-m-d H:i")); $events = $page->find("template=event, event_start>$today, sort=event_start, limit=10"); $pagination = $events->renderPager(array( 'numPageLinks' => "5", 'nextItemLabel' => "Next", 'previousItemLabel' => "Prev", 'listMarkup' => "<ul class='MarkupPagerNav'>{out}</ul>", 'itemMarkup' => "<li class='{class}'>{out}</li>", 'linkMarkup' => "<a href='{url}'><span>{out}</span></a>")); echo "<ul class='list'>"; foreach($events as $event) { echo "<li class='list-item'>"; echo "<h5><a href='{$event->url}'>{$event->title}</a></h5>"; echo "<em>{$event->event_start}</em>"; } echo "</ul>"; echo $pagination; While on the section page it only lists events assigned to that section: <?php echo eventList($pages->find("template=event, section={$page}, event_start>=$today, sort=event_start, limit=5")); What I would like is to give people the ability to filter the list of events on the events page to choose just the events assigned to the section they want to look at. I imagine the functionality to be similar to the modules section on the processwire.com site whereby you can select an author and the page reloads to show only modules by that author. Can I use a select drop-down and have it update the variable and reload the page? Thanks in advance.
  7. I'm not sure I completely understand not having the ?> because the content following the PHP snippet is just plain HTML? All my templates look similar in structure to the head.inc included with the PW download. Otherwise brilliant ideas. I guess learning PHP and ProcessWire is a progressive thing and I will gradually pick up the shortcuts. I gave it a go but I think there is something missing from the code <?php /* Function Name: newsList Arguments: $newsItems Returns: */ function newsList($newsItems) { if (!count($newsItems)) return "There are no news-items found."; $out = ""; $out .= "<ul class='list'>"; foreach($news as $newsitem) { $out .= "<li class='list-item'>"; $out .= "<h5><a href='{$newsitem->url}'>{$newsitem->title}</a></h5>"; $out .= "<em>{$newsitem->news_date}</em>"; $out .= "</li>"; } $out .= "</ul>"; return $out; } <?php include 'functions.php'; echo newsList($pages->find("template=news-item, section={$page}, sort=-news_date, limit=5")); ?> Should $news be $newsItems?
  8. Thanks guys. Quite right on all counts. The section tag has been left there from the many copy/paste/delete operations!
  9. I have set up a site that has a news section available for all site editors to post news items. They can select one or more sections using the 'section' field which is a pageListSelectMultiple. I would like only the news items assigned a particular section to show up in that section. The code I am using on the section page works but I am unsure how it is doing it or whether it is the correct way. Any feedback is much appreciated. <?php $section = $page; $news = $pages->find("template=news-item, section={$section}, sort=-news_date, limit=5"); echo "<ul class='list'>"; foreach($news as $newsitem) { echo "<li class='list-item'>"; echo "<section>"; echo "<h5><a href='{$newsitem->url}'>{$newsitem->title}</a></h5>"; echo "<em>{$newsitem->news_date}</em>"; echo "</section>"; } echo "</ul>"; ?>
  10. I had a problem here but figured it out, with Somas help
  11. In the pages tree, if a page is locked for edits and the user doesn't have Lock/Unlock permission, then the edit link shouldn't show.
  12. So there are two selectors I need: One to grab all pages that are children of the news-month-archive template site wide. One to grab all pages that are children of the news-month-archive template in the current rootParent Anybody help me out?
  13. Have a look at http://unsemantic.com/demo-responsive there is a bit of javascript buried in there that will show you the width of an element as it is resized.
  14. Arrrgghhh it's always the little things that trip me up. Thanks diogo
  15. I would like to get all the child pages of the news-month-archive template sort them by -news_date and limit to 10 per page. This is what I have at the moment: <?php $results = $pages->find("template=news-item, sort=-news_date, limit=10"); $pagination = $results->renderPager(array( 'numPageLinks' => "5", 'nextItemLabel' => "Next", 'previousItemLabel' => "Prev", 'listMarkup' => "<ul class='MarkupPagerNav'>{out}</ul>", 'itemMarkup' => "<li class='{class}'>{out}</li>", 'linkMarkup' => "<a href='{url}'><span>{out}</span></a>")); echo "<ul class='list'>"; foreach($results as $result) { echo "<li class='list-item'>"; echo "<section>"; echo "<h5><a href='{$result->url}'>{$result->title}</a></h5>"; echo "<em>{$result->news_date}</em>"; if($result->body) { $summary = substr($result->body, 0, 150); if(($pos = strrpos($summary, ".")) !== false) { $summary = substr($summary, 0, $pos); }; echo "<p>{$summary} <a href='{$result->url}'>...more</a></p>"; } echo "</section>"; } echo "</ul>"; echo $pagination; ?> How can I rewrite the selector to achieve this? I tried $results = $pages->find("template=news-month-archive")->children("sort=-news_date, limit=10"); but I get a server error? Many Thanks
  16. Hello, I was just wondering, in the tips you mention '- You will improve usability if you dont allow the user to create date archives manually.' Can you elaborate on what you mean and how to go about it? Is it done with the family or access settings for each template? Thanks Never mind I figured it out. Thanks again for this module.
  17. Thanks for the tips, you will be pleased to know I managed to figure it out! : <?php /** * Search template * */ $out = ''; if($q = $sanitizer->selectorValue($input->get->q)) { // Send our sanitized query 'q' variable to the whitelist where it will be // picked up and echoed in the search box by the head.inc file. $input->whitelist('q', $q); // Search the title, body and sidebar fields for our query text. // Limit the results to 50 pages. // Exclude results that use the 'admin' template. $matches = $pages->find("title|body|sidebar~=$q, limit=50"); $pagination = $matches->renderPager(array( 'numPageLinks' => "5", 'nextItemLabel' => "Next", 'previousItemLabel' => "Prev", 'listMarkup' => "<ul class='MarkupPagerNav'>{out}</ul>", 'itemMarkup' => "<li class='{class}'>{out}</li>", 'linkMarkup' => "<a href='{url}'><span>{out}</span></a>")); $count = count($matches); if($count) { $out .= "<h2>Found $count pages matching your query:</h2>" . "<ul class='nav'>"; foreach($matches as $m) { $out .= "<li><p><a href='{$m->url}'>{$m->title}</a><br />{$m->summary}</p></li>"; } $out .= "</ul>"; } else { $out .= "<h2>Sorry, no results were found.</h2>"; } } else { $out .= "<h2>Please enter a search term in the search box (upper right corner)</h2>"; } // Note that we stored our output in $out before printing it because we wanted to execute // the search before including the header template. This is because the header template // displays the current search query in the search box (via the $input->whitelist) and // we wanted to make sure we had that setup before including the header template. include("./head.inc"); echo $out; echo $pagination; include("./foot.inc");
  18. Thanks argen, Yes I have enabled page numbers but I can't figure out how to incorporate the code to render the pagination?
  19. Hello, I am just using the basic search template and was wondering how to enable pagination for the search results, it is simple enough to do for other pages just can't get it working for search. <?php /** * Search template * */ $out = ''; if($q = $sanitizer->selectorValue($input->get->q)) { // Send our sanitized query 'q' variable to the whitelist where it will be // picked up and echoed in the search box by the head.inc file. $input->whitelist('q', $q); // Search the title, body and sidebar fields for our query text. // Limit the results to 50 pages. // Exclude results that use the 'admin' template. $matches = $pages->find("title|body|sidebar~=$q, limit=50"); $count = count($matches); if($count) { $out .= "<h2>Found $count pages matching your query:</h2>" . "<ul class='nav'>"; foreach($matches as $m) { $out .= "<li><p><a href='{$m->url}'>{$m->title}</a><br />{$m->summary}</p></li>"; } $out .= "</ul>"; } else { $out .= "<h2>Sorry, no results were found.</h2>"; } } else { $out .= "<h2>Please enter a search term in the search box (upper right corner)</h2>"; } // Note that we stored our output in $out before printing it because we wanted to execute // the search before including the header template. This is because the header template // displays the current search query in the search box (via the $input->whitelist) and // we wanted to make sure we had that setup before including the header template. include("./head.inc"); echo $out; include("./foot.inc");
  20. Has anybody had issues with the anchor button? For me it just seems to grey out the entire screen and I can't do anything until I refresh the page, which I have to do by clicking refresh as it also disables the keyboard shortcut.
  21. Hi Renobird, Yep I was able to get it working! Thanks for the lovely clear example
  22. http://www.bestvendor.com/apps/cms/processwire
  23. Renobird, this is amazing, can't wait to get home and try it out. Before I get my knickers in a twist though could you clarify the suggested page tree structure? Something like: Home --Calendar (calendar.php template) URL segments enabled? --Event 1 (event.php template with title, start date, end date etc) --Event 2 Is that correct?
  24. Renobird built this lovely calendar here. Is there a way to do this just using a date field? Is it possible to extract just the month from a date for example and foreach it?
×
×
  • Create New...