Jump to content

Robin S

Members
  • Posts

    4,792
  • Joined

  • Days Won

    303

Everything posted by Robin S

  1. FYI: there is a GitHub issue open for this problem.
  2. Check that the MarkupSimpleNavigation module is actually installed. The class returned for $treeMenu should be "MarkupSimpleNavigation".
  3. Looks okay to me. A couple of minor things that won't be related to your problem: $sanitizer->username is deprecated in favour of $sanitizer->pageName I don't see where you set the default state of $error, so you may get an undefined variable notice when an exception is not thrown. Things to try: log $username and $password before $session->login() to check that the variables are holding the correct information. can you login with this username and password at the PW admin login?
  4. Not working as in fatal error or as in no menu? I take it that there are some pages in your top level that you don't want to include in the menu - can you describe what you're trying to achieve?
  5. Are you sure you're using the "selector_field" option correctly? What is the contents of this field on pages where you are using it - is it a valid selector? I would consider "selector_field" to be an advanced option that isn't needed for most menus. For most situations the "selector" option is sufficient.
  6. How about making the title field non-global and removing it from your newsletter template? Maybe you can set your page name automatically using the "Name format for children" feature so users don't need to worry about typing a valid page name.
  7. In /site/init.php... $config->css_files = new \ProcessWire\FilenameArray(); $config->js_files = new \ProcessWire\FilenameArray(); In your Hanna Code PHP... $config->css_files->add('/site/templates/path/to/file.css'); $config->js_files->add('/site/templates/path/to/file.js'); Wherever you output your <head>... foreach($config->css_files as $css_file) { echo "<link rel='stylesheet' href='$css_file'>"; } foreach($config->js_files as $js_file) { echo "<script src='$js_file'></script>"; } See the code for the FilenameArray methods available: prepend(), remove(), removeAll(), etc. P.S. you can use the existing core $config->styles and $config->scripts FilenameArrays but other files might be added to these by certain modules so cleaner to create your own FilenameArrays I think.
  8. Just used this snippet - really great solution!
  9. I think the problem here is the way you are mixing PHP and HTML together: <? foreach($page->home_sliders as $home_slider) { <li class='orbit-slide'> This isn't valid PHP - you need to either echo all the HTML or switch in and out of PHP like so... <?php foreach($page->home_sliders as $home_slider): ?> <li class="orbit-slide"> ...more HTML... <?php endforeach; ?> As an aside, the short PHP open tag <? is discouraged - the short echo tag <?= is okay though.
  10. Better to store the selected pages in a PageArray: $children = $page->children; $uniques = new \ProcessWire\PageArray(); // assumes PW3 foreach($children as $child) { $uniques->import($child->size); } $uniques->sort("title"); foreach($uniques as $unique) { echo "<button class='filter' data-filter='.size_{$unique->title}'>{$unique->title}</button>"; }
  11. In a related topic in the ProFields sub-forum @ryan has said: So please log any SQL mode issues at GitHub as they arise so they can be tracked and resolved.
  12. If you mean they display content from your web server in an iframe then it doesn't matter what server technology is involved (PW or otherwise) because the iframe content loads on your server not theirs. You could use a URL segment such as /embed/ so that pages loaded with this segment do not include header, footer, etc but only the panorama content. Might not be something you want to tackle but just wanted to point out that it's possible. I'm not aware of any existing module that does this, but as I mentioned in an earlier post above wouldn't be difficult to create your own module that lists directories as options in a select field. The trick is getting the names of the valid directories you want to include as options into an $options array.
  13. Two possible solutions for your author/member pages: 1. Use separate templates for your author and member pages. For the author Page field (used in the publi template) your "Custom selector to find selectable pages" is: template=author|member To differentiate between author and member in your foreach loop: if($item->template->name == 'member') { // do something only for members } 2. Only use a single template for all authors (including members), but add a checkbox field 'member' to the author template to signal if the author is a member or not. To differentiate between author and member in your foreach loop: if($item->member == 1) { // do something only for members }
  14. Using $page->render() to render the page with its template file (or another file you specify) has been around much longer than the $page->render('some_field') introduced in PW3 but the documentation has been a bit lacking. The cheatsheet doesn't help much and it's not covered in the new API reference - the best explanation I have found is this post from Ryan. Personally I think it would be clearer if individual fields were rendered exclusively with $page->renderField(). Using the existing $page->render() method when that was previously used for rendering whole pages with different options (e.g. the ability to pass your own array of variables) leads to some confusion.
  15. I think you access the array with $options rather than $page->options.
  16. $author = $pages->find("template=member, title=$page"); This part doesn't make sense unless you have a page using the member template whose title is a page ID. I don't think you need this line.
  17. More thoughts... 1. Could you reproduce the path to the PW page as a folder structure inside /site/templates? If your page is at mydomain.com/gallery/location-1/pano-1/ then you put the dependent files in /site/templates/gallery/location-1/pano-1/ and build the path to the files with: $config->paths->templates . $page->path() Then you don't need to select a folder in the PW admin (you just have to remember to upload your files to the right folder). 2. I reckon that by inspecting the code in the dependent files you'll be able to work out how to output it directly from your template file. Then you don't need to deal with these folders of dependent files at all - just upload the images to an image field on your page. Could you share an example of one of these pano folders so we can see what's in the code?
  18. $page->render("some_field") is an alias for $page->renderField(), and passing in an array of your own variables is not supported currently. I agree that it would be useful and have opened a feature request on GitHub.
  19. For a Map Marker field named 'map'... function renderLocationsXML($locations) { $out = '<?xml version="1.0" encoding="utf-8"?>'; $out .= '\n<markers>'; foreach ($locations as $location) { // use any fields of $location $out .= "<marker name='{$location->title}' lat='{$location->map->lat}' lng='{$location->map->lng}' />"; } $out .= '\n</markers>'; return $out; } $locations = $pages->find("template=location"); header("Content-Type: text/xml"); echo renderLocationXML($locations);
  20. Or: // get publication from this author $publi = $pages->find("template=publication, author=$page"); Author and Member are the same thing, right?
  21. I get the reason for having manual control of where links/abbreviations appear, but what do you think about adding an option where terms are replaced automatically? It would be nice to give the user the ability to add new terms to the glossary without having to go through all their pages looking for where the term appears and adding the ||term|| syntax manually.
  22. I believe the lazy cron can be triggered on every pageload by every user, including guest, and you don't need to add the db-backup permission to guest for this to happen. I asked about this too and @kixe responded... Agreed. Also, the module description on GitHub and the modules directory seems to contradict the above so perhaps that needs to be corrected?
  23. Technically you can specify a subject line in the PW link dialog, but there isn't a dedicated field for it. mailto:me@mydomain.com?subject=my subject line
  24. Just wanted to add that if, as in the OP's case, you are going to foreach the children then there is no additional penalty to using $page->children()->count() because you will be loading the children into memory anyway.
  25. I gotta say, how awesome is that we're in a community where we can hire PW's main man to help with our projects?! Like, can you imagine a world where you can't decide on your Facebook cover image so you call in Zuckerberg for a consult?
×
×
  • Create New...