Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by Neo

  1. Thanks, diogo. That worked and looks much cleaner.
  2. I have the following simple site-structure: HOME - Portfolio (portfolio-list.php) - Category A (portfolio-category.php) - item a1 (portfolio-item.php) - item a2 - item a3 - Category B - item b1 - item b2 - item b3 - Category C - item c1 - item c2 - item c3 I would like to show 6 random items from the Portfolio on HOME, for which I wrote the following code: <!-- jCarousel --> <section class="jcarousel recent-work-jc"> <ul> <?php // $portfolio_children = $pages->get("/portfolio/")->children(); // Get children of portfolio page foreach ($portfolio_children as $children) { // Get children's children foreach ($children->children("limit=6, sort=random") as $child) { echo '<li class="four columns">'; echo '<a href="'.$child->url.'" class="portfolio-item">'; echo '<figure>'; $first_image = $child->project_gallery->first()->width(460); echo '<img src="'.$first_image->url.'" alt="'.$first_image->description.'"/>'; echo '<figcaption class="item-description">'; echo '<h5>'.$child->title.'</h5>'; echo '<span>'.$child->parent->title.'</span>'; echo '</figcaption>'; echo '</figure>'; echo '</a>'; echo '</li>'; } } ?> </ul> </section> <!-- jCarousel / End --> The problem is that it gets all portfolio items. The random sorting works, but not the 'limit=6'. Any idea what is wrong?
  3. I had a few situations were I needed to limit the output of a textarea-field to e.g. 150 characters and / or strip all html-tags to work with plain text. I used the sanitizer-function like in the following example: <?php // Echo the latest 3 items on homepage foreach($pages->get("/services/")->children("limit=3, sort=-created") as $service){ // sanitizer options $options = array( // maximum allowed characters for multibyte strings 'maxLength' => 150, ); $service_preview = $sanitizer->textarea($service->body, $options); echo '<div class="one-third column">'; echo '<article class="icon-box">'; echo '<h3>'.$service->title.'</h3>'; echo '<p>'.$service_preview.'... </p>'; echo '</article>'; echo '</div>'; } ?> Is that the only way to limit character-output of a textarea?
  4. Following the news-system tutorial (https://processwire.com/talk/topic/2985-how-to-create-a-simple-news-system-for-pw/), I am currently implementing the pagination for the list view, which uses the "Pager"-module (https://processwire.com/api/modules/markup-pager-nav/). The pagination works, however I am unable to add a custom class to the current, active page. The class simply does not show up in the markup. Here is my code: // Pagination $out .="<nav class='pagination'>"; $out .= $newsposts->renderPager(array( 'nextItemLabel' => "Next", 'previousItemLabel' => "Prev", 'currentItemClass' => "current", 'listMarkup' => "<ul>{out}</ul>", 'itemMarkup' => "<li>{out}</li>", 'linkMarkup' => "<a href='{url}'>{out}</a>", )); $out .="<div class='clearfix'></div>"; $out .="</nav>"; Would appreciate you advice.
  5. Finally used the selector option to remove all template-specific pages, in this case the categories from the portfolio: 'selector' => 'template!=portfolio-category' Thanks.
  6. To better understand the ProcessWire API, I built a simple Portfolio site with the following page structure: - HOME - Page A - Page B - Portfolio (lists all available items) - Category A - item a1 - item a2 - item a3 - Category B - item b1 - item b2 - item b3 - Category C - item c1 - item c2 - item c3 For the menu I am using the Markup Simple Navigation module (http://modules.processwire.com/modules/markup-simple-navigation/). Now, I would like to hide all child pages from the Portfolio page in the menu (only from the portfolio page, no other top-level menu items). Would appreciate your advice how to achieve this.
  7. @MuchDev sure, always happy to see ideas and input. Setting up the basic structure with the pages is fairly simply. What I am struggling with a bit is a category function for each post. Instead of having to create a specific page in the tree for each category under which you can post new items, I would like to be able to create / assign the category within the news item's page.
  8. Sorry, now I got it. You're right; it works. An additional redirect in the template might make sense for the case that the page-link is accessed directly.
  9. Unfortunately, this did not work. A simple alternative could be to redirect to the first child within the template of the parent as suggested here: https://processwire.com/talk/topic/15-how-do-i-create-a-page-that-redirects-to-its-first-child/?p=25 <?php if($page->numChildren) $session->redirect($page->child()->url); This, however, has the downside of a 301-redirection from a SEO perspective. Isn't there a recommended solution how to deal with such a situation? I am sure that is a common situation that users don't want to display a specific list view for a parent page.
  10. The markup for the menu is generated by the Markup Simple Navigation menu: https://processwire.com/talk/topic/1036-markupsimplenavigation/ Correct, I just need a hash for this menu item. Removing the complete anchor will remove the item from the menu.
  11. It's a simple list element: <li class="has_children"> <a href="/processwire/page-c/">Page C</a> <ul style="visibility: visible; display: none;"> <li><a href="/processwire/page-c/child-c1/">Child C1</a></li> <li><a href="/processwire/page-c/child-c2/">Child C2</a></li> <li><a href="/processwire/page-c/child-c3/">Child C3</a></li> </ul> </li>
  12. In order to learn and better understand how PW works, I would like to build a simple blog / news system, where articles can be posted under different categories and an overview page lists all available posts with pagination. Within the site's menu (I am using Markup Simple Navigation), the overview page should just be displayed ("blog / news") without showing any child pages. I don't want to use a module. The only tutorial I found so far is the following: http://wiki.processwire.com/index.php/Simple_News_System Is this the only tutorial available / the recommended approach? Would appreciate your guidance and advice.
  13. Great. Thanks for your detailed solution and explanations.
  14. I am having the following simple site-structure and use the Markup Simple Navigation module for the menu, which works without problems: HOME - Page A - Page B - Page C - child c1 - child c2 - child c3 - Page D Now, as I don't want to provide an overview page / list view under Page C to display the different child pages, I am searching for a way to remove the link of Page C from the menu. At the moment it still contains the link, which leads to the template specified for Page C. How can I remove this specific link without affecting other top-level pages with children (for which I might need the overview)?
  15. I finally ended up using the recommended Markup Simple Navigation module, which is probably the cleanest and most customizable solution without reinventing the wheel. Thanks a lot.
  16. I basically just got started with ProcessWire, followed the beginners tutorials and just try to implement a test site using the beginners template. My PHP knowledge is limited, so please bear with me. What I am trying to achieve is implement a second level for the menu resembling the following html structure: <ul class="menu" id="responsive"> <li><a href="index.html" id="current"> Home</a></li> <li><a href="about.html"> About</a> <li><a href="#"> Services</a> <!-- Second Level / Start --> <ul> <li><a href="service1.html">Service 1</a></li> <li><a href="service2.html">Service 2</a></li> <li><a href="service3.html">Service 3</a></li> <li><a href="service4.html">Service 4</a></li> </ul> <!-- Second Level / End --> </li> <li><a href="#"> Portfolio</a> </ul> Following the example in the beginners template, I managed to get the first level going: <ul class="menu" id="responsive"><?php // top navigation consists of homepage and its visible children $homepage = $pages->get('/'); $children = $homepage->children(); // make 'home' the first item in the navigation $children->prepend($homepage); // render an <li> for each top navigation item foreach($children as $child) { if($child->id == $page->rootParent->id) { // this $child page is currently being viewed (or one of it's children/descendents) // so we highlight it as the current page in the navigation echo "<li><a href='$child->url' id='current'>$child->title</a></li>"; } else { echo "<li><a href='$child->url'>$child->title</a></li>"; } } ?></ul> However, I am struggeling with the the second-level. Would appreciate your guidance.
  17. Thanks for your detailed answers. This leaves me with a really positive impression about the dedication of the Processwire community. Something that is unfortunately missing in the WordPress ecosystem. I will start building my templates and and then step by step incorporate Processwire-functionality. I keep you posted during this process and ask you for advice when I should get stuck. Thanks again. Great support.
  18. Hi, I am a front-end developer with only limited knowledge of PHP, currently looking for an alternative to WordPress in order to build custom websites with dynamic functionality. I have never built a site with Processwire, so my idea is to develop a test-project that reflects the typical requirements of my clients (usually small businesses) in order get an idea how the system works. These requirements typically are: - Brochure style / informational sites - Multiple, editable content areas per page - Portfolio functionality: clients want to post their products / projects with text description and images in different categories - Latest portfolio items are displayed on the front page (e.g. latest 6) - Editable slideshow on the front page (text and image) - News / Blog functionality - Latest news / blog excerpts are displayed on the front page - Custom contact forms My idea, as an example, is to build something like the following website, which combines all these typical requirements pretty well: http://www.turnerconstruction.com/ I have a couple of questions considering the described use case scenario: - How realistic is it for a front-end developer with only limited PHP knowledge to develop the required functionality with Processwire? - What time frame would you suggest for a project like this for someone who just starts with Processwire? - What is the typical workflow? Can I build the complete, static site with HTML, CSS, JS and then turn this into Processwire afterwards? I would appreciate your advice. Thanks a lot.
  • Create New...