Jump to content

Robin S

Members
  • Posts

    4,928
  • Joined

  • Days Won

    321

Everything posted by Robin S

  1. If I can make it like this above my css will be work perfectly but can't fixed yet.... Try setting this as part of your $options array: 'xtemplates' => 'home', 'xitem_tpl' => '<a href="#home">HOME</a>', 'xitem_current_tpl' => '<a href="#home">HOME</a>', By the way, you have many settings in your $options array that are identical to the defaults - these are unnecessary.
  2. I think that's because when you use your Hanna tag in CKEditor your audio attribute is (or should be) valid link markup, e.g. <a href="/some/url/">LINK</a> But in the Hanna Code test tab the attribute is not a valid link but simply the string "LINK" which cannot be parsed by SimpleXML. So probably nothing to worry about, but if the error message is a concern you can do some simple check to see if the attribute looks like it will be a link. For example, at the top of your Hanna code: if(substr($audio, 0, 2) !== '<a') return;
  3. Problem seems to be here: $paths = array($root); Might be misunderstanding something but don't think the root directory is wanted in that array.
  4. I'm seeing an error in the new Captain Hook panel on Windows - I think it's the path slashes issue. ErrorException: file_get_contents(D:/Websites/__www/1testing/wire/): failed to open stream: No such file or directory in D:\Websites\__www\1testing\site\assets\cache\FileCompiler\site\modules\TracyDebugger\CaptainHook\classes\CaptainHookSearch.php:44 Dumping $filenamesArray in CaptainHookSearch::getHooks() shows paths like... "D:/Websites/__www/1testing/wire/" "D:/Websites/__www/1testing/wire\config.php" "D:/Websites/__www/1testing/wire\core\admin.php" "D:/Websites/__www/1testing/wire\core\boot.php" ... Edit: actually, it might be the first item in the array that's the problem: "D:/Websites/__www/1testing/wire/". Seems like this shouldn't be in there seeing as it's a directory and and not a .php or .module file.
  5. This rules - so useful! Thank you @adrian, thank you @owzim!
  6. Here is an example of grouping news items under date headings according to a "post_date" datetime field. The headings are the dates (formatted as per the "Date Output Format" specified in the datetime field settings), unless the date equates to "Today" or "Yesterday", in which case those strings are used. You should be able to adapt this to your needs. $news_items = $pages->find("template=news_item, sort=-post_date"); $previous_item_date = ''; foreach($news_items as $news_item) { if($news_item->post_date !== $previous_item_date) { $timestamp = $news_item->getUnformatted('post_date'); if($timestamp >= strtotime('today')) { $date = 'Today'; } elseif($timestamp >= strtotime('yesterday')) { $date = 'Yesterday'; } else { $date = $news_item->post_date; } echo "<h3>$date</h3>"; // output the date heading } echo "<p>$news_item->title</p>"; // output whatever fields of the item $previous_item_date = $news_item->post_date; }
  7. In earlier versions of PW, all repeater items in a page would be loaded when opening Page Edit - this could cause problems if there were a lot of repeater items. But in recent versions repeater items may be ajax-loaded, meaning repeaters can now scale up much better than previously. So there's no reason to avoid repeaters. Also see Repeater Matrix, which is more similar to PageTable in that it allows for multiple matrix types (sort of equivalent to templates). You could use RuntimeMarkup in conjunction with a Page Reference field. You would configure a RuntimeMarkup field to get and format the fields from band pages currently selected in the Page Reference field. Note that after changing the Page Reference field you would need to save the page in order to see the RuntimeMarkup field update.
  8. I have been playing around with the code from @Raymond Geerts, getting the pagination working. Thought I would post this for posterity: $limit = 10; $limit_first = 8; $offset = $limit - $limit_first; if ($input->pageNum == 1){ $results = $pages->find("limit=$limit_first"); } else { $start = (($input->pageNum - 1) * $limit) - $offset; $results = $pages->find("start=$start, limit=$limit"); } // output result items echo $results->each("<p>{name}</p>"); // override pagination $results->setLimit($limit)->setTotal($results->getTotal() + $offset)->setStart((($input->pageNum - 1) * $limit)); // output pager echo $results->renderPager();
  9. You or your client must have some deep pockets for font licensing. From the DTL website:
  10. Welcome to the forums! I think you're on the right track here. Not sure that you need an end date field in the band description repeater - just the start date (a datetime field that defaults to today's date). In your event template file, for each selected band page you would get the most recent band description that is dated earlier than the event date. Inputfields such as AsmSelect have an option to edit pages in a modal window.
  11. Yep, you want a Page Reference field on the child pages. For "Label field" select the text field used in your repeater. Use the "Custom PHP option" for "Selectable pages" by creating the following hook in /site/ready.php: $wire->addHookAfter('InputfieldPage::getSelectablePages', function($event) { if($event->object->name == 'my_page_reference_field') { $page = $event->arguments('page'); $event->return = $page->parent->podcast_show; } });
  12. Using wire('pages') in a template file shouldn't cause an error (not sure why that's happening), but in template context you would normally access this API variable as $pages. In fact, in your screenshot you are doing that a few lines below on line 36.
  13. Check out Runtime Markup: http://modules.processwire.com/modules/fieldtype-runtime-markup/
  14. Hi @xavier, welcome to the ProcessWire forums. The code you have posted looks like AngularJS - I'm not sure this is the right place to get support for that. If you are just getting started I suggest you use straight PHP and HTML for your first ProcessWire project and leave AngularJS until you are more familiar with ProcessWire. That way it will be easier for people to help you here in the PW forums.
  15. Why not? Seems like a paragraph tag is the appropriate markup for a paragraph of text.
  16. Purchasing a dev licence for Form Builder is a no-brainer: if you place a dollar value on your time you will quickly realise that after only a small number of forms it has saved you $$$.
  17. There is a multi-language support subforum: you might do better to ask your questions there. I've never built a multi-language website myself as there is no demand for it in my part of the world (sadly Maori/English dual-language websites are rare in NZ).
  18. Although you can insert a static menu into your template, usually a CMS-powered website would use a menu that is generated dynamically according to the pages in the website. The text in the menu would be sourced from the titles of the pages. To create translations of page titles you can install the language support modules. I suggest you read the language support documentation, and the section about multi-language fields in particular.
  19. This isn't actually an installable profile though - you can explore the template files but without the database from the demo site it's not as useful as it could be. @ryan, could you please make an exported profile of the demo available?
  20. Based on the fact that you do not have URLs in the link hrefs I guess this menu is for navigating to blocks of content within a single page. Rather than hardcode this menu into the template and translate it using __() you could consider using a Repeater / Repeater Matrix for your content blocks and add a title field to your repeater items. Then you can create translations for the titles in Page Edit and generate your menu dynamically. Seems like it would be easier to maintain that way.
  21. If you want pages where a field is not empty you don't need to deal with the fieldsets/templates at all. Just: $count = $pages->count("title!='', has_parent!=2");
  22. Using a primary category in a parent-child relationship has some benefits: Visitors can see the relationship demonstrated in the URL and breadcrumb navigation The site structure is intuitive as visitors "drill down" through the page hierarchy to more specific pages There is some SEO benefit Finding a page in the admin page tree may be easier for site editors But this type of page structure is only possible (or only sensible) when a child page will belong exclusively to a single category of that type. So in the case of the skyscrapers demo it works for the city relationship as a building can only ever be in one city. But it wouldn't work for the architect relationship as it is conceivable that a building could be designed by more than one architect. And you wouldn't want to have duplicated building content under two ore more different architect parents. In the case of a turtle, you could for example use the taxonomical hierarchy in parent-child relationships: Trachemys scripta can only ever belong to a single genus, and so on up the hierarchy. But you wouldn't want to use "Native to" in a parent-child relationship as this would be both Mexico and the United States. @webhoes, matching to a page object / page ID like this is very reliable, but in most cases your Page field (habitat) will be limited to a single template and/or parent and the the titles of allowed pages will be unique. So you can cut out a step and do: $swampAnimals = $pages->find("template=animal, habitat=Swamp");
  23. Try: $template_has_title = $fields->get('title')->getFieldgroups()->implode('|', 'name'); $page_has_title = $pages->find("template=$template_has_title, has_parent!=2"); If you just want the count of the pages rather than the pages themselves you can do: $count = $pages->count("template=$template_has_title, has_parent!=2");
  24. A way you could do this without any code: 1. Create one image field for the first image and one image field for the second/subsequent image(s). 2. Set "Min width for uploaded images" to 200 for the first image field. Incidentally, your original post says that the first image should be under 200 pixels wide, but that doesn't make sense so I assume you mean over 200 pixels wide. 3. Make both image fields "required".
  25. When deciding whether or not to use a parent-child structure to create a relationship, the questions I ask are: 1. Is this relationship a primary (very important) relationship? 2. Do I want the relationship to be revealed in the page URL? (Note that other types of relationship may still be represented in a URL via the URL Segments feature) 3. Is the relationship exclusive? (i.e. may the child only belong to a single category/parent - you want to avoid a situation where the same page would appear under more than one parent). If the answer to any of these is "no" then I use a Page field for the relationship rather than a parent-child structure.
×
×
  • Create New...