-
Posts
4,956 -
Joined
-
Last visited
-
Days Won
100
Everything posted by LostKobrakai
-
How to import table of data into ProcessWire
LostKobrakai replied to Tony Carnell's topic in General Support
$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(); } -
If I understand you right that's just a multi-column version of what you see in the "Children" tab of the page editor.
-
How to import table of data into ProcessWire
LostKobrakai replied to Tony Carnell's topic in General Support
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. -
Unexpected behaviour order of images in slideshow
LostKobrakai replied to pwired's topic in General Support
You can create tabs with FieldsetTab. Instead of just grouping fields this fieldset will additionally create a new tab, where fields will reside. -
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.
-
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.
-
Shorter API calls - which do you use?
LostKobrakai replied to Peter Knight's topic in Getting Started
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. -
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/
-
@kongondo Cannot agree more. It's sad to see such bad journalistic work being published by a platform like tuts+.
-
View multiple tags at any one time, rather than just one...
LostKobrakai replied to a-ok's topic in General Support
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"); -
You can enable debug mode in the site/config.php to get more information on errors.
-
Custom Comment Output - Best Practice
LostKobrakai replied to Dave Damage's topic in Getting Started
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. -
Custom Comment Output - Best Practice
LostKobrakai replied to Dave Damage's topic in Getting Started
How about the "Optional: Generating your own output" variant outlined here: http://processwire.com/api/fieldtypes/comments/? -
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.
-
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.
-
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/
-
Syncing PageAutocomplete and PageListSelect
LostKobrakai replied to Mike Rockett's topic in Module/Plugin Development
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. -
Syncing PageAutocomplete and PageListSelect
LostKobrakai replied to Mike Rockett's topic in Module/Plugin Development
I just wonder, the inputfield dependencies need the html inputs to update as well, otherwise it won't work. -
Syncing PageAutocomplete and PageListSelect
LostKobrakai replied to Mike Rockett's topic in Module/Plugin Development
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. -
Syncing PageAutocomplete and PageListSelect
LostKobrakai replied to Mike Rockett's topic in Module/Plugin Development
Isn't there a hidden inputfield, which is updated. Without that it won't submit anything. -
Somehow the "Own Tab" setting doesn't seem to work on a 2.6.14 installation, leaving the functionality inside of "Children" does work.
-
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.
-
Creating new responsive theme based on Foundation
LostKobrakai replied to formmailer's topic in Themes and Profiles
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.- 10 replies
-
- getting started
- responsive
-
(and 2 more)
Tagged with: