Leaderboard
Popular Content
Showing content with the highest reputation on 04/07/2014 in all areas
-
4 points
-
Do not go down that road, it is a dark and miserable path where fellow travelers seek to fill your pages with a contagion of confusion and dismay. Aside from the occasional notion of "oh, this might actually work", you will find yourself subject to the chains of their template systems. At the end of the day, though your site may work, you may cringe at the mere mention of changing anything in it. And it only gets worse as your projects become more involved. (Speaking from experience.) Stay here, it's nice here.3 points
-
@bwaked, from the most recent posts you've done I conclude you don't fully understand the basic principles of the Wirearray / Pagearray. I can imagine that those are a little harder to understand. Next, I think to see is that you're still struggling with PHP. This is not a problem on it's own. But when you try to learn the ProcessWire basics next to it, it is maybe one little thing to much. Most people learn from little steps, expanding on the things already learned. The PW docs are written to be as simple as possible and on the same time it covers all the basics you'll need to know to get started.3 points
-
First PW-meetup in Finland will take place at Tampere, Friday 2.5.2014, 12:00. I'll give you exact address when it's confirmed, but it will be walking distance from Tampere railway station. It will be free event for everyone. Avoine will offer some coffee and if we get really lucky, some cookies also. I think we will have something between 5-10 people coming, so it will not be that formal event. If you have anything you want to talk or show, please get in touch with me (antti@avoine.fi / 041-4383991). Anything goes - showcase something you have build, tell us about the great idea for module, propose plan that will help PW to spread in Finland etc.. After the 3 or 4 hours we can change location to pub and continue the world changing plans. No registration required, but always to happy to hear if you are coming (here or email).3 points
-
One way without module would be to just enbale urlSegments on home/root template. Then do create urls with domain.com/1003 Then in the template something like this: if($input->urlSegment1){ $id = (int) $input->urlSegment1; $p = $pages->get("id=$id, include=hidden"); if($p && $p->id && $p->viewable()) { echo $p->render(); } else { throw new Wire404Exception(); } } else if(count($input->urlSegments) > 1) { throw new Wire404Exception(); }2 points
-
Thank you guys, All above comments starting to make more sence to me now. But I must admit, I certainly need to look in php and learn more. I was really afraid I needed to go back to joomla or wordpress! My best bet is to simply forget about using a site profile (responsivenes > is so inviting) which often make it more difficult (functions > that I do not fully understand), or (wire > something) = huh?, and focus on the more simple ways to display content. So upon trying to understand the php, and also the API / cheatsheet, please share some php learning sites like the one linked above.2 points
-
If you look on the cheatsheet, right below $a[$key] is $a->$key. If you want to translate that to your current page you could simply replace $a with $page. Or in your code example, $item. So you have: $a->$key is the same as $item->summary: $a is the page ($item) being referenced, and $key is the index or, in this case, the field name (summary). According to the cheatsheet: $a->key returns the VALUE of the item at the given $key. Therefore, $item->summary returns the string that you have in a text field. But look at what happens with $item->myfield: myfield is a PageArray and title is a field: Translates to "return the value of the PageArray at the given field title". PageArray's don't have title fields, pages do. Therefore iteration is required to access the title field of each page in the array referenced by myfield. It's easy to over complicate PW's API. You have to be mindful of its syntax, the usage of the variables/methods available, and the return values of the methods being used or you will in for a bumpy ride: and that's with any API you decide to use.2 points
-
So I created a little python script. https://gist.github.com/anonymous/10001724 create a new file and give it execute permissions chmod +x ./pw You can fetch the lastest PW code from git an start a new project. ./pw <new-project-name> Also if you want a specific version ./pw <new-project-name> dev 2.4.0 Will create a new folder with your project name if you need help ./pw help Tested in my Linux machine.2 points
-
This module provides a way to rapidly generate Page fields and the required templates and pages for use as a drop down select (or any other Page field type). This module will let you create a full page field setup in literally a few seconds To use, run Page Field Select Creator from the Setup Menu Enter a Field Title, eg: Room Types Select Options - These will become the child pages that will populate the page field select options. There are two different options. Option 1. TITLE FIELD ONLY - enter one option per line, eg: Single Double Suite Option 2. MULTIPLE FIELDS - the first line is used for the field names and the first field must be 'Title'. Subsequent lines are the values for the fields, eg: Title, Number of Beds, Number of People, Kitchen Facilities Single, 1, 1, Fridge Only Double, 2, 2, Fridge Only Suite, 3, 6, Full Kitchen Choose the parent where the page tree of options will be created, eg a hidden "Options" parent page Select a "Deference in API as" option depending on your needs Choose the input field type Check whether "Allow new pages to be created from field?" should be enabled. As an example, if you entered "Room Types" as the field title, you would end up with all of the following automatically created: a fully configured page field called: room_types MULTIPLE FIELDS OPTION - 3 additional fields - number_of_beds, number_of_people, kitchen a parent template called: room_types a child template called: room_types_items (with either just a title field, or with the 3 additional fields as well) a parent page called: Room Types a series of child pages named and titled based on the per line entries in the Select Options textarea The templates are configured such that the "room_types_items" child template can only have the main "room_types" template as a parent, and vice versa. Then all you have to do is add the newly created page field to any template you want and you're ready to go! You can grab it from: Modules directory: http://modules.processwire.com/modules/process-page-field-select-creator/ Github: https://github.com/adrianbj/ProcessPageFieldSelectCreator1 point
-
This module creates a blank dashboard page in your site admin and sets it as default when you login instead of the page list. It came from a need in a few projects where I was creating modules for various user roles to use and I didn't want them to see the page list at all, but needed to display various stats and quick access buttons. For example, if you have a person who is creating invoices or doing other back-office stuff in various other Process modules then as an admin you wouldn't want them to access the page tree anyway, and there are other scenarios where you might want to have a dashboard instead of launching straight into the page list. It also requires (and adds) a permission - "dashboard" - so you can create new roles and assign the dashboard permission to those roles - something you might want to do fairly commonly if you have a lot of admin modules that you want to restrict access to. Editing the template is simple - there is a dashboard.php template file in the /site/modules/ProcessDashboard/ folder (decided to leave it in there to keep it safe, but I might be tempted to move it into /site/templates/ ) as well as .js and .css files ready to add your code to. You can use the API as you usually would to create your dashboard experience. For example, display data based on user roles or even specific users using code like this: if ($user->hasRole('invoices') { echo "Hi staff member $user->name. View invoices to be processed below: ... ..."; } if ($user->name == 'pete') { // Show some super-awesome stuff here } You can also do away with the dashboard.php template file and edit the module directly, putting your code and output in the execute() function (the way most Process modules are written) but I decided to include the separate template file to make it easier for more people to use. This does touch on areas a few other modules have addressed to some degree (like diogo's Custom Admin Pages) but this is designed for one purpose - instant dashboard creation. You can download the module here: http://modules.processwire.com/modules/process-dashboard/ This module also uses code from diogo's ProcessHomeAdmin module so that the default admin page can be overridden.1 point
-
We are now hosting our own store here at processwire.com (previously it was hosted through the DesignIntelligence bookstore). You'll see it as the STORE button on the upper left corner (next to FORUMS and MEMBERS). By hosting it here, we are able to provide better service to you. If you purchase a product through the store, your access in the forums is upgraded automatically at purchase time. Previously people had to request access or I had to track people down and tell them to create a forum account, etc. So the new system is much more automated. Now you can pay by credit card or by PayPal. Previously we could only accept credit card. Now you can purchase upgrades from one version to another. For instance, if you purchased ProCache Single and wanted to later upgrade to ProCache Developer, it lets you do so by paying only the difference in cost. This only works if you have done all the purchases through the new store. (If you did it through the old store and want to upgrade, then just PM me and I'll setup a special coupon code for you that subtracts the cost you already paid). The new store brings more revenue back to development of the ProcessWire project since our merchant fees are now a lot lower (2.5% rather than 10%). We will be adding more products to the store in the coming months, including more modules and enhanced ProcessWire support options for those that want it themselves or for their clients. A change to the FormBuilder and ProCache policies. Previously the developer or agency versions specified that you could install as many copies as you wanted, but only for 1-year (at which time you would renew if you wanted to install more). That time limit has been removed. When you purchase the developer or agency version of either product, you have no time limits. Incidentally, I've never enforced any time limits on either product, but just wanted to state it officially since I've recently been asked about it. The product pages also state this now. The only 1-year limitation that remains in effect is for support and upgrades. The new store lets you renew that automatically or manually, if you want to. The yearly support renewal cost is roughly 1/4 the product cost. For example, $10 for Form Builder Single. Coupon code (today through Saturday) To celebrate the opening of the new store and to make sure we put it through it's paces (not to mention, test the coupon code function) I've setup a coupon code that lasts from today to Saturday (April 1). The code will give you 10% off any Form Builder or ProCache version. The code is NEWSTORE. Please let us know if you see anything that we can improve in the purchase or checkout process. For those interested, the new store runs on IP.Nexus, which is a commercial add-on component to IP.Board (the forum software we use). The merchant gateway is provided by Stripe. A huge thanks to Pete (the forum administrator here) for recommending all this and helping to get everything setup.1 point
-
Here are some API additions to the dev branch, primarily for WireArray/PageArray/etc. I've found these very handy lately, and would have on almost any project I worked on, so decided they'd add value to the core. I'll add these to the cheatsheet once 2.4 replaces 2.3, but for now, here they are. The examples here use PageArray, but note that these API additions apply to any WireArray derived type, not just PageArray. WireArray::implode() Implode all elements to a delimiter-separated string containing the given property from each item. Similar to PHP's implode() function. Usage: $string = $items->implode([$delimiter], $property, [$options]); Arguments: $delimiter - The delimiter to separate each item by (or the glue to tie them together). May be omitted if not needed $property - The property to retrieve from each item (i.e. "title"), or a function that returns the value to store. If a function/closure is provided it is given the $item (argument 1) and the $key (argument 2), and it should return the value (string) to use. [$options] - This argument is optional. When used, it's an array with modifiers to the behavior: skipEmpty: Whether empty items should be skipped (default=true) prepend: String to prepend to result. Ignored if result is blank. append: String to prepend to result. Ignored if result is blank. Examples: $items = $pages->find("template=basic-page"); // render all the titles, each separated by a <br>, for each page in $items echo $items->implode('<br>', 'title'); // render an unordered list of each item's title echo "<ul><li>"; echo $items->implode('</li><li>', 'title'); echo "</li></ul>"; // same as above, but using prepend/append options, // this ensures no list generated when $items is empty echo $items->implode('</li><li>', 'title', array( 'prepend' => '<ul><li>', 'append' => '</li></ul>' )); // same as above, but with all items now presented as links // this demonstrates use of $property as a function. note that // we are also omitting the delimiter here as well, since we don't need it echo $items->implode(function($item) { return "<li><a href='$item->url'>$item->title</a></li>"; }, array('prepend' => '<ul>', 'append' => '</ul>')); WireArray::explode() Return a plain array of the requested property from each item. Similar to PHP's explode() function. The returned PHP array uses the same keys as the original WireArray (if that matters). Usage: $array = $items->explode($property); Arguments: $property - The name of the property (string) to have in each array element (i.e. "title"). You may also provide a function/closure here that should return the value to store. When a function/closure is used it receives the $item as the first argument and the $key (if needed) as the second. Examples: // get an array containing the 'title' of each page $array = $items->explode('title'); // get an array containing the id, url and title of each page $array = $items->explode(function($item) { return array( 'id' => $item->id, 'url' => $item->url, 'title' => $item->title ); }); WireArray::data() Store or retrieve an arbitrary/extra data value in this WireArray. This is exactly the same thing that it is jQuery. I've personally found this useful when building search engines: the search engine can store extra meta data of what was searched for as a data() property. Then any other functions receiving the WireArray/PageArray have access to this additional info. For example, the search engine portion of your site could populate an array of summary data about what was searched for, and the render/output code could render it to the user. Usage: // Setting data $items->data('key', 'value'); // Getting data $value = $items->data('key'); // Get array (indexed by key) of all data $values = $items->data(); Arguments: The above usage section explains all that's needed to know about the arguments. The only additional comments I'd make are that 'key' should always be a string, and 'value' can be anything you want it to be. Example: function findSkyscrapers() { $floors = (int) wire('input')->get->floors; $year = (int) wire('input')->get->year; $items = wire('pages')->find("template=skyscraper, floors=$floors, year=$year"); $items->data('summary', array( 'Number of floors' => $floors, 'Year constructed' => $year )); return $items; } // the render function can focus purely on output function renderSkyscrapers($items) { echo "<h2>You searched for:</h2>"; // render the summary of what was searched for foreach($items->data('summary') as $label => $value) { echo "<p>$label: $value</p>"; } echo "<h3>Skyscrapers found:</h3>"; // note use of new implode() function, though a foreach() would be just as well here echo $items->implode(function($item) { return "<p><a href='$item->url'>$item->title</a></p>"; }); } WireArray::and() WireData::and() Return a new copy of the WireArray with the given item(s) appended. Primarily as a syntax convenience for various situations. This is similar to jQuery's add() and andSelf() functions, but I've always felt "add" implied adding something to the original rather than creating a new combination, so went with "and" in this case. The term "and" is actually a reserved word in PHP, so you can't usually have a function named "and()", but through the magic of hooks, ProcessWire can. This function should reduce the instances in which you'd need to do "$a = new PageArray();" for example. Usage: // create a new WireArray with $items and $item (appended) $myItems = $items->and($item); // create a new WireArray with $items and $moreItems (appended) $myItems = $items->and($moreItems); // create a new WireArray with $items and $item (prepended) $myItems = $item->and($items); // create a new WireArray with $item and $anotherItem (appended) $myItems = $item->and($anotherItem); // create a new WireArray 4 items $family = $pappa->and($mamma)->and($brother)->and($sister); Examples: // generate breadcrumb trail that includes current page foreach($page->parents->and($page) as $item) { echo "<a href='$item->url'>$item->title</a> / "; } // check if page or its children has a featured checkbox if($page->and($page->children)->has("featured=1")) { echo "<p>Featured!</p>"; }1 point
-
There you go, Julien http://www.foodloversdiary.com/good-stuff/my-kind-of-food-the-bow-tie-duck-review/1 point
-
@diogo : I'm the one to blame I'm experimenting different conversion models because the Philippines market is quite a difficult one for this segment. Thanks for your appreciation! @Joss : A review would be wonderful! For food writing, why not We should discuss about it!1 point
-
Everything looks great! The site and the food You're probably not the one to blame, but those facebook buttons —especially the one in the nav— kill some of the charm...1 point
-
There's a beneficial thing for that Module. You can quickly find embedded video's just by searching video images.1 point
-
There is an option in the module config settings for that - it's called Redirect Type: Redirect vs Load. You'll want the load option. Just an FYI - the modules automatically adds a canonical link to the full url to help search engines.1 point
-
This module will get the thumbnails for you automatically: http://modules.processwire.com/modules/process-get-video-thumbs/1 point
-
HI jiloml, Welcome to PW and the forums.. Regarding your "learning PHP" question: https://processwire.com/talk/topic/2994-learning-php/ https://processwire.com/talk/topic/6030-learning-php-where-to-learn-just-enough-to-make-living-w-pw-easier/1 point
-
Look at the code provided by Wanze. Or you could trigger a delete of the cache after Pages::save class DeleteMarkupCache extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Delete cache module', 'singular' => true, 'autoload' => true ); } public function init() { $this->pages->addHookAfter('save', $this, 'deleteCache'); } public function deleteCache($event) { $page = $event->arguments[0]; if($page->template != 'wanted-template') return; // now do your logic. } }1 point
-
Exactly! One thing at a time. In PW things are not tied together like in other CMSs, this is what makes it so flexible. You will learn faster if you focus on the content. Test with a blank page, you'll see it's fun. And once you know how to print in that blank page exactly the parts of the content you want, it will be so easy to take any responsive theme and apply it to your site1 point
-
Your "summary" field is not a PageArray, therefore, you can't really iterate through it as one. Hence the reason it's "gone". The "my_select" field, if it is a Page Field, can be iterated, therefore the loop grabs the title. If you wanted to determine if the field needs iterating, you could do a simple count. If the # of objects that count finds is greater than 1, you've got to iterate. Using your code: // render optional extra fields wrapped in named spans if(count($options['fields'])) { // Iterate options['fields'] array foreach($options['fields'] as $name) { // If the page's field returns more than one object if (count($item->$name) > 1){ // Iterate the PageArray referenced by the "my_select" field foreach($item->$name as $pageField){ // Grab title $out .= $pageField->title."<br/>"; } } else{ $out .= "<span class='$name'>" . $item->$title . "</span> "; //Or whatever you want to do } } } Definitely not the most elegant solution but it highlights some important aspects of PW fields. In order to iterate through the "sub"-fields of a field set as a Page Field type: you must iterate through those pages. And for a field that would be returning just a string or numeric value, like your $page->summary, you simply return that value to wherever you want it to go. I wasn't 100% sure what you were trying to accomplish but I hope this helps you over that little hump.1 point
-
@bytesource I just pushed an updated TextformatterTextile module that adds a new formatter: TextformatterTextileField that should do just what you need without you having to hook things or use the P stripper.1 point
-
You better re-read this answer to your previous question: https://processwire.com/talk/topic/6013-difference-select-aka-dropdown-vs-page-field-type/?p=58768 Hint.... $page->myselect->title; $page->myselect->template; $page->myselect->id; $page->myselect->child->name; $page->myselect->headline;//custom field $page->myselect->othercustomfield;//custom field $page->myselect->this; $page->myselect->that; $page->myselect->that->and->and->and;//you get the picture... Here's your other homework...will the above work in a function?1 point
-
Does this do what you are looking for? http://modules.processwire.com/modules/process-redirect-ids/1 point
-
We've been using vagrant quite a lot in the past. It's a good way of ensuring everyone working in a Team has the same Serversetup as close to the live System as it can get. It has some performance and complexity drawbacks though. Currently we've mostly switched back to "good ol localhost" for most projects1 point
-
i have a weird hobby: i try to know all key bindings in the world off by heart ... no, no. no reason to leave st2 for the next big thing. never change a running system!1 point
-
Think of how much better it would be if I added a WillyC beard. Also, that is what happens after 2 weeks in the recording studio.1 point
-
SALE ITEM Custom "welcome jingle" to go with your new processwire site - guaranteed to make your visitors toes curl!1 point
-
Thanks for reporting this Niklas, I will look into it right away. A question about what you saw. The way the PayPal payment works is that it sends you over to PayPal's site, you pay there, then it redirects you back to the store (it uses PayPal IPN). Did you see the PayPal error at PayPal's site or at processwire.com?1 point
-
Hey Ryan, great News. I want to buy Pro Cache and would like pay with Paypal, but Paypal says a Error: "Unfortunately, the last action could not be completed." Edit: With firefox everything goes fine. With chrome paypal says the error.1 point
-
Hi all, today I finally managed to get everything working together properly. Now here is my Foundation 5 dropin template: https://github.com/gebeer/pwfoundation5. It uses Foundation 5 SCSS files. There's a quite extensive readme file with instructions. The template is based on Ryans FoundationSiteProfile. My approach takes advantage of the SASS/SCSS/Compass technology. So the output of the final CSS is highly customizable and only one file (style.css) is put out. You have full control over which modules of the Foundation framework you want to include in your project. This results in smaller CSS files that can be minified upon compilation with Compass. You can use the template as is. But if you want to modify the CSS, you need to have additional software (Ruby/Compass/Zurb Foundation gem) installed on your machine. In the template's Readme.md you will find instructions on how to do this (for Mac and Linux machines - Windows: sorry I don't know). If you are familiar working with SASS/Compass you will find your ways around easily. I have setup a structure that allows for updating the Foundation framework independently and that separates the project specific css from the Foundation css. This is a work in progress and I'm planning on using it for the relaunch of my own website. If you find any bugs, please let me know here or on the github bug tracker. I will try to fix them. Everyone is welcome to contribute or ask questions. Cheers gerhard1 point
-
@bcartier: The ImportPagesCSV-module can't do this as is. But I tried making a tiny addition to make it support FieldtypePage (those used to make page references) and it worked amazingly well. The only change needed was to add 'FieldtypePage' to $fieldtypes array (just before init() function if you take a look at the module file), like this: protected $fieldtypes = array( 'FieldtypePageTitle', 'FieldtypeText', 'FieldtypeTextarea', 'FieldtypeInteger', 'FieldtypeFloat', 'FieldtypeEmail', 'FieldtypeURL', 'FieldtypeCheckbox', 'FieldtypeFile', 'FieldtypePage', // add this line ); After that addition it's possible to choose a Page field when connecting the fields from the CSV to the ones in the chosen template. I had pre-populated categories at the target site and used their id's in the CSV file to reference those categories. Multiple categories worked like a charm as well, just use a pipe in between id's (123|456|789). Moreover, if you've got only one category per entry to reference, then you don't even need the id's of the categories - you can use paths as well. Here's a little example: cat.csv: title one two three four entries.csv: title,categories a,/cats/four/ b,/cats/three/ c,/cats/one/ d,/cats/two/ Import cat.csv using a template for categories with (at least) title field, under a page at /cats/. Then import entries.csv using a template for entries, having a title field and a page field. This should leave you with entries that are connected to categories. I hope this gets you somewhere. @ryan: Looks like page references could be supported very easily. I just used this successfully to import ~3500 pages with category references from an old site to a new PW one. But maybe there's still something else to be done before they're fully supported?1 point
-
I have found the import CSV module to be really useful, and has become a big part of my site building workflow with processwire. It's much easier to collect and manage lots of data in excel / numbers and then directly import into processwire. This is also great for updating content with a re-import. I think data journalists and data hackers will find this sort of functionality very useful for doing quick data visualisation mashups (especially when you add on the friendly pw api). I think content strategists will like this workflow as most of them use excel for collecting and organising site content at the start of projects. And of course the clients will like it - this will be a nice way to start a new project - once basic site structure is agreed, we can give the client an excel template (or google doc) and tell them to start adding content. Wouldn't it be great to start a project with actual real content! I hope you continue adding support for other pw fields like page-references and dates (I use pages extensively for category management). Could this module also work in the opposite direction and export the data to CSV? Then we just need to work out a way to import / export fields and templates as much as I admire the processwire interface, I still think managing data / settings / fields is much quicker and easier in text files, at least at the beginning of a project. Processwire - a CMS that gets out of the way.1 point