Jump to content

LostKobrakai

PW-Moderators
  • Posts

    4,956
  • Joined

  • Last visited

  • Days Won

    100

Everything posted by LostKobrakai

  1. $myDB = new Database('localhost', 'username', 'password', 'db_name', 3306); $result = $myDB->query("SELECT * FROM my_table"); while($row = $result->fetch_assoc()) { $p = new Page(); $p->template = "dam"; $p->parent = "something"; $p->title = $row['title']; $p->save(); }
  2. If I understand you right that's just a multi-column version of what you see in the "Children" tab of the page editor.
  3. You don't even necessarily need the csv step. You could also create a php file which connects to the existing database and then imports them to pw via the api.
  4. You can create tabs with FieldsetTab. Instead of just grouping fields this fieldset will additionally create a new tab, where fields will reside.
  5. Also keep in mind that you can change the max. number of child pages the tree will show before paginating results. If you find it cluttered maybe reduce the number a bit.
  6. The problem for google is that the crawler most likely will be redirected everytime it visits your site, depending on how "first visit" detection is implemented. For real users it's bad if you just autodetect the language without letting them change the language afterwards, everything else is no problem.
  7. I'd suggest taking a look at VersionControl. The plugin is certainly the goto reference for a "compare field-data" topic.
  8. There's a fundamentally difference between your example strings. The first one is using tags, that are mostly used in conjunction with WireArray::implode and WireArray::explode or in newer versions you can also use them in the backend to create custom pageList labels in templates. These use the wirePopulateStringTags() helper function, that does replace the tags with their value out of a known or provided context. Nothing as fancy as a templating language, but nice for simpler usage. The second one is plain php, but the curly braces are actually optional as long as you're just calling a direct property of the variable. If you want to call deeper nested properties, then you need the curly braces (e.g. "<span>{$page->parent->title}</span>"). One last notable difference, while the tags are just strings, and therefore work no matter how they are created, the php string interpolation does only work when using double quotes.
  9. You've two options here: using string-tag-replacement or a function like you tried <?php $cats = $page->blog_category; echo $cats->implode(", ", "<a href='{url}'>{title}</a>"); // or (notice the first implode argument) echo $cats->implode(", ", function($cat) { return "<a href='$cat->url'>$cat->title</a>"; }); Detailed instructions about how these api functions work can be found here: https://processwire.com/talk/topic/5098-new-wirearray-api-additions-on-dev/
  10. @kongondo Cannot agree more. It's sad to see such bad journalistic work being published by a platform like tuts+.
  11. You can use GET vars to do so: <?php // URL: www.domain.com/tags/?tags=events,films,outdoor // // Alt. URL with different template than tags overview: // www.domain.com/tags/multiple/?tags=events,films,outdoor $tags = $sanitizer->selectorValue($input->get->tags); $taggedPages = $pages->find("…, tags=$tags");
  12. You can enable debug mode in the site/config.php to get more information on errors.
  13. Threaded views can be quite simply done by recursive functions, as you can see in the renderNav function that's part of the default installation profile in pw. If that's not sufficient than you've only the option to copy the whole module or ask ryan to add the necessary hooks.
  14. How about the "Optional: Generating your own output" variant outlined here: http://processwire.com/api/fieldtypes/comments/?
  15. To add fields you need to change various places: sleepValue(), wakeupValue(), sanitizeValue() and the database-something functions in the Fieldtype and the render() function in the inputfield. Also you need to reinstall the module (or at least the fields) after changes to the database structure function, as existing tables won't be updated.
  16. The email template is also a html template, that's send as body of the email. You could copy and modify that existing code logic and instead of sending it via email send it though an html to pdf module / converter.
  17. You can manage the GET variables on your own using the "getVars" option. A slightly more detailed description can be found here: http://processwire.com/api/modules/markup-pager-nav/
  18. That's the other part of the coin - actually setting values to those inputfields, but retrieving should work, as the inputfield dependencies need to do exactly the same.
  19. I just wonder, the inputfield dependencies need the html inputs to update as well, otherwise it won't work.
  20. I wasn't sure about that, I think asmSelect is permanently syncing it's list and inputfield. But this only happens on submits, then you're left with not syncing those fields (which is probably not an expected usecase) or trying to fake the submit event without actually submitting stuff.
  21. Isn't there a hidden inputfield, which is updated. Without that it won't submit anything.
  22. Somehow the "Own Tab" setting doesn't seem to work on a 2.6.14 installation, leaving the functionality inside of "Children" does work.
  23. Whenever you need to have snippets of markup included I'd suggest using wireRenderFile and just call the snippets in. With this function it doesn't matter if these are purely static content or not.
  24. While I'm using Foundation in a current project I'm still not keen on both of those frameworks. The only thing I always liked is the ready-made form styling, but I found this scss for that a few weeks ago: http://formhack.io/. Otherwise I just use normalize.css and some grid system (haven't found the optimal yet) for my websites. If it just needs to be an internal webapp of sorts I stick to Bootstrap, as it's the prettier one.
×
×
  • Create New...