Leaderboard
Popular Content
Showing content with the highest reputation on 04/08/2014 in all areas
-
WWF sponsors a number of projects to track wildlife with satellite tags - this Processwire/Google Maps tool lets the public follow along in nearly real time. There are 6 different species and over 40 individual animals. http://wwfgap.org/tracker/ This is the second iteration using Processwire - it was a delight to work with. Feedback welcome!11 points
-
I would like to present to you our (the Agency I work for) so far largest Processwire project, that I've built. We've launched it a few month ago, but I had allways forget to post it here. It is a campaign-website of various food-processing companies, located in the northern Germany. The purpose of the site is to present diverse jobs, apprenticeships, traineeships and study programs, which are avaiable in the companies to a wide crowd of young people. On this central point the companies can show how versatile the opportunities in the food-processing industry are. The site is not responsive, but has an alternative Mobile View, which will be displayed, if a "Mobile"-Device/User Agent is identified. Finally, one more big thank to teppo, for his essential advice to make the scaled images happen. foodstarter.de6 points
-
I have several ideas in mind for directory-based websites, and came across ProcessWire in my search for a starting point about a year ago. There are several good WordPress themes that are commercially available, but all the ones I've seen have various limitations that would preclude their use for what I have in mind. As a starting point for experimenting with ProcessWire, I had access to a list of churches and used that to develop a map-based directory here: Baptist Blue Book. The central issue for me was the map interface, and how to handle a reasonably large number of listings (~6,000) in that view (Most of the WordPress themes I had come across restricted the map view to a certain city, which I suspect was to limit the number of markers that had to be loaded.) A few notes: I'm using Ryan's Form Builder to accept suggestions for new listings. I liked having the packed solution for this, and the ability to control what happened to those submissions on the back end (e.g., the ability to hold them in a queue for review rather than posting immediately to the site). The church pages are subdivided by state (e.g., Directory > Texas > [church name]) by using a script to push a new listing to the proper sub-directory once it's approved. In hindsight, this may be an overly limiting approach, particularly for adapting it to international use, but once I had started on that path I needed to stick with it and focus on other issues. For the map view, a separate script pulls the latitude, longitude, and page-id from all listings and caches that in a JSON file. When the Map page is viewed, that file is retrieved and used to generate the markers. The content for the popups is only loaded as needed to minimize bandwidth. (Side note: I'm using MapBox for this, along with Leaflet and the MarkerCluster add-in.) All in all, I've been very pleased with the flexibility of ProcessWire, as well as the helpfulness of the community. I've also noticed several directory-type sites listed in the showcase, so I'm wondering if it might be useful to develop a module tailored to that application (or is each one so unique that this would not be feasible)? Any comments or feedback would be welcome. Brian5 points
-
No worries. Just for info if you do anther map-related project in future, I found that http://leafletjs.com/ is a very good map library that's much easier to use and configure than Google or Bing (to me at least). There are a lot of similarities but I find Google can get a bit tricky once you stray too far from the basic functionality. There are also a wide variety of other mapping providers you can use: http://leaflet-extras.github.io/leaflet-providers/preview/index.html Not a suggestion that you should switch, just worth mentioning since this is a topic related to mapping and it's saved me a tonne of time recently.5 points
-
If you wanted to take this further... Set up a template called searched_words (or whatever) Add an additional field called count (number field) template: searched_words fields: title, count in _init.php (enable this in config.php) write a few lines of code to grab the search keywords if they exist. //do something if we have q in the url ($q=searchstring) //check to see if the searchstring is already in the database //if it is just increment the count field //if it's new add a new page and set the count to one The advantage here is being able to pull out all of your searched words and phrases ordering by count. You'll want to know which words are more heavily searched, because it means your users aren't finding what they are looking for. I used this technique when I was a CTO for an online retailer. It helped us understand which products we needed to carry, the language our users preferred (e.g. sneakers or shoes), and it illuminated our blind spots (e.g. if a lot of people were searching for privacy policy, we knew we either needed to add a privacy policy or make it easier for our users to find if it already existed).5 points
-
Which Module do you use? MarkupRSS ? I don't know if this helps, but at least it's try-able I updated Ryans MarkupRSS module as there was an issue with date & I added the ability to use enclosures. MarkupRSS is not yet updated in the core, but you can get the updated version with the link below. MarkupRSSEnhanced.module ( be aware that this one has a slightly different name )4 points
-
Just off the top of my head, CSV files are easily read by Excel, so you could create a php file that bootstraps PW to generate a CSV file, outputting the appropriate mime-type etc.3 points
-
Just to add a little to sshaw's comments, logging search queries in that kind of way can also help identify searchers' commonly misspelt words. I used to work for an online sports retailer and one manufacturer (Daiwa) was commonly misspelt as 'Diawa'. It makes no business sense to return no search results on a simple misspelt query such as this. A simple preg_replace() can fix obvious user errors like this, but a more elegant solution using, for example, mySQL's 'SOUNDS LIKE', searching your stored search history can quite easily be used to generate suggestions like google does ('Did you mean "Daiwa"?').3 points
-
Recently I got a brand new iMac so I needed to install PHP SQL and configure Apache. I'm using the same web develop environment for years and I'm really happy with it. Raymond is also using this and Arjen did the same recently. I love to share how I setup this environment in a step by step tutorial. Let's setup PHP, MYSQL and activate mail using gmail smtp for OSX 10.6 and up, perfectly suitable for ProcessWire. It doesn't install Apache, it uses the Apache installation, which comes with OS X. The PHP installer package is created by Liip and it is based on entropy's php package. For MYSQL we gonna install the DMG Archive (x86, 64-bit). After we installed PHP, we configure Apache & PHP so that we’re able to run the ProcessWire sites in our own ~/Sites directory. For El Capitan see Arjen's https://processwire.com/talk/topic/5797-setup-a-processwire-environment-on-a-fresh-macos-x-install/?p=103674 Install PHP We gonna use the PHP installer created by Liip. (more information) Go to: /Applications/Utilities/ Open: Terminal.app Type: curl -s http://php-osx.liip.ch/install.sh | bash -s 5.5 Press: RETURN Type: your admin password Press: RETURN ( download starts and continues with a the install ) note: If you want to have an older PHP version, replace 5.5 with 5.4. (PHP 5.5 is the current stable) After the install is completed Apache is restarted and complains about “Could not reliably determine the server's fully qualified domain name, using your-computer-name.local for ServerName”. This notice is not a problem, we only use this Mac for local website development. Setup Apache Open a new finder window. Press: shift + command + g ( Go to folder ) Type: /etc/apache2/ Press: go Open: httpd.conf Find the line: #Include /private/etc/apache2/extra/httpd-vhosts.conf Remove the # infront to enable. Press save and enter your password when asked. Enable the use of ~/Sites folder:Open the folder /etc/apache2/users/ * Duplicate the Guest.conf and name it martijn.conf Open the duplicated file that we created * Change: <Directory "/Users/Guest/Sites/"> to <Directory "/Users/martijn/Sites/"> Change: AllowOverride None, to AllowOverride All Save the file. The file should look like: <Directory "/Users/martijn/Sites/"> Options Indexes MultiViews AllowOverride All Order allow,deny Allow from all </Directory> Configure the vhosts includes Open /etc/apache2/extra/httpd-vhosts.conf Comment out the 2 VirtualHost examples by putting a # in front Be sure that NameVirtualHost *:80 doesn’t start with a # sign. * Add the include: include /Users/martijn/Sites/_vHosts/*.conf at the bottom of the file. Save the file, password will be asked. The file should at least have these two lines: NameVirtualHost *:80 include /Users/martijn/Sites/_vHosts/*.conf * ( Replace martijn with your short admin name ) The ~/Sites folder (Users/martijn/Sites) Goto your user Home folder. Create the Sites folder in your user home ( if not exist ) Create inside the Sites folder a folder called _vHosts Create the folder domains inside the ~/Sites folder Create a folder inside the domains folder called processwire ( processwire will be the domain name ) Inside the processwire folder create 2 directories: 1. htdocs 2. logs ( make this writeable by right click the folder and choose Get info ) Create inside the htdocs folder a file called index.html with some content. The folder structure should look like: ~/Sites |`-- _vHosts | `-- domains | `-- processwire | |-- htdocs | `-- index.html | `-- logs Configure PHP Open the file: /usr/local/php5/php.d/99-liip-developer.ini ( This file is the last ini file that gets loaded, so perfectly suitable for your personal settings ) Make your personal changes here. ( setting xdebug.max_nesting_level=1000 for example if needed ) Save the file ( password will be asked. ) Make an alias the this file by right click and choose: Make Alias Name the alias _settings.ini or what ever you want to name it. Move the alias to your ~/Sites folder Create a vHostIn our ~/Sites folder we created a folder named _vHosts. This folder we gonna use for the vHosts. All files ending with .conf in this folder will be loaded when we (re-)start Apache. Create a new file with your favourite text editor. Type the following in the file: ( Replace martijn with your short admin name ) <VirtualHost *:80> DocumentRoot /Users/martijn/Sites/domains/processwire/htdocs/ ServerName processwire ErrorLog /Users/martijn/Sites/domains/processwire/logs/error.log.txt CustomLog /Users/martijn/Sites/domains/processwire/logs/access.log.txt common </VirtualHost> Save the file with the filename processwire.conf in the folder _vHosts The hosts fileGo to the Finder Press: shift + command + g ( Go to folder ) Type: /etc/hosts & press return Open the hosts file with you favourite editor Type 127.0.0.1 processwire below 127.0.0.1 localhost but above 255.255.255.255 broadcasthost Save the file Right click the file & choose: Make Alias Move the alias that you created to your ~/Sites folder Rename it to _hosts The file should look like: ## # Host Database # # localhost is used to configure the loopback interface # when the system is booting. Do not change this entry. ## 127.0.0.1 localhost 127.0.0.1 processwire 255.255.255.255 broadcasthost ::1 localhost fe80::1%lo0 localhost Test the Apache & PHP setup Go to: /Applications/Utilities/ Open: Terminal.app Type: sudo apachectl restart Press: RETURN Type: your admin password Press: RETURN At this point Apache & PHP will be up and running.Go to a browser and type: processwire/ in the address bar and press enter. MYSQL For managing MySQL databases I use Sequel Pro it's a very handy tool and in this tutorial we set the root user password with it. For the SQL server we gonna use the MySQL DMG Archive (x86, 64-bit) Download the following: MySQL DMG Archive (x86, 64-bit) Sequel Pro Open the mysql-5.6.16-osx10.7-x86_64 image * install mysql-5.6.16-osx10.7-x86_64.pkg, MySQLStartupItem.pkg & install the prefPane * if MACOSX complains about: ( mysql-5.6.16-osx10.7-x86_64.pkg” can’t be opened because it is from an unidentified developer. ) You should open your System Preferences, go to Security & Privacy and Allow apps downloaded from: Anywhere Set the root user password Double click the sequel-pro-1.0.2.dmg. The disc image will mount Drag'n'drop the Sequel Pro.app to your /Applications/ folder. Open Sequel Pro Type by name: 127.0.0.1 Type by host: 127.0.0.1 Type by username: root Login Press command + u Select the root user on the left side Fill in the password Press apply We're Done ----- Todo how to use it after the setup is complete2 points
-
Thank you very much, that's exactly what the issue was. Everything is back to normal now. Where the heck is the "tip" button?2 points
-
I have recently used this code to create CSV, works great. // array, with for each row an array $array = array( array('val 1 - row 1', 'val 2 - row 1', 'val 3 - row 1'), array('val 1 - row 2', 'val 2 - row 2', 'val 3 - row 2'), array('val 1 - row 3', 'val 2 - row 3', 'val 3 - row 3'), etc... ); $out = ''; $handle = fopen('php://temp', 'r+'); // temp read/write file-like wrapper foreach ($array as $line) fputcsv($handle, $line, ',', '"'); rewind($handle); while (!feof($handle)) $out .= fread($handle, 8192); fclose($handle); echo trim($out);2 points
-
@cstevensjr, congrats. - The most used app on my mac: Quicksilver. (I mainly use it as app loader/switcher) - I love this web environment. - AppTrap (Remove useless settings & stuff from apps you trash) - Sip (Pick & bookmark your colors to use it everywhere ) - Hex Color Picker (Add a hex color picker to every application. )2 points
-
GitHub: https://github.com/adrianbj/ProcessMigrator This module has gone through lots of iterations with lots of new functionality each time. It is now a fully fledged content migration tool. *** Please be sure to read the GitHub ReadMe to find out what it can do now as most of the posts in this thread are no longer correct regarding its functionality Once it is release worthy, I'll create a fresh thread with all the details. This modules allows export, sharing, and import of page lists via JSON files. It takes care of replicating all the pages, as well as creating any templates and fields that are needed. I have defined "Page Lists" as page trees (parent and children) that store selector values for a Page fieldtype. An example would be a list of countries that would be used to populate a countries drop-down select field. The fields might include: Country Name, 2-digit code, 3-digit code, number code. I would like to suggest a place where we can post json files to be shared and updated - maybe a dedicated github repository? Start of a repo of lists ready to import is now available: https://github.com/adrianbj/ProcessWirePageLists It might handle migrating other simple pages trees as well, but it should not be considered a tool for migrating general pages as it does not handle associated files, nor does it handle fields which store arrays. Probably lots of other things it doesn't handle either It now handles migrating all (I think) field types, including repeater fields, page fields, all Profields fields, multi-language versions of fields etc. The only omission is the actual uploaded files and images in file/image fields. WARNING: This should be considered an Alpha module - please don't use this on a live site at the moment and be sure to back everything up before testing. Would appreciate any feedback on the concept, the code, and the idea of a shared and community edited resource of these files. Also, would love to hear what page lists would be good to share. Here are a few quick ideas: States (separate files for each country) Measurement units Languages Religions Race Academic subjects (chemistry, biology etc) Publication types (book, journal article, newspaper article, newsletter, thesis etc) Car makes and models Anyone have a better idea for a name, or how to better describe "Page Lists"?1 point
-
Just wanted to post it here for others that might look for an example. I'm currently working on importing a Site to PW2.1. Following code I figured is needed to create pages using the Bootstraped API: <?php include(./index.php) // bootstrap PW $p = new Page(); // create new page object $p->template = 'page'; // set template $p->parent = wire('pages')->get('/about/'); // set the parent $p->name = 'mynewpage_url'; // give it a name used in the url for the page $p->title = 'My New Page'; // set page title (not neccessary but recommended) // added by Ryan: save page in preparation for adding files (#1) $p->save(); // populate fields $p->image = 'path/to/image.jpg'; // populate a single image field (#2) $p->images->add('path/to/image1.jpg'); // add multiple to images field $p->save(); // testing echo 'id: '.$p->id.'<br/>'; echo 'path: '.$p->path; Note: in PW 3 with multi-instance support adding new Objects https://processwire.com/blog/posts/processwire-2.6.21-upgrades-comments-more-on-pw-3.x/#more-updates-on-processwire-3.0 [Edit by Ryan #1] Added first $p->save(); [Edit by Ryan #2] Changed $p->image('...') to $p->image = '...';1 point
-
To interact with the images field. Create a new field (under Setup > Fields) and call it whatever you want, like "images" for example. Set the field type as "image". Add this field to a template (under Setup > Templates). Then edit a page using that template and upload some images. In your template code: ProcessWire will create your images at any size on the fly and then keep a cache of them. For instance, lets say we want to cycle through all the images, create a large image at 500 pixel width with proportional height, and a thumbnail at 100x100, and then have the thumbnail link to the large: <?php foreach($page->images as $image) { $large = $image->width(500); $thumb = $image->size(100, 100); echo "<a href='{$large->url}'><img src='{$thumb->url}' alt='{$thumb->description}' /></a>"; }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
-
1 point
-
Launched just a few days ago: http://yummimami.de - a presentational website for a German startup supplying healthy and kid-compatible presented food to schools. Some features Responsive Forms via FormBuilder Navigation via MarkupSimpleNavigation (which, at least in my use case, evolves into something super essential for PW - like Views for Drupal for example ) Widget handling via having a big pool with pages of template type "widget", then referencing (and hence, rendering) them on content pages Editorial influence on the homepage teasers main color via SVG + field + ColorPicker (not necessary to that extent since the customer doesn't need to change the color to any other that magenta, green or brown - but still: proof of concept)1 point
-
1 point
-
Nice site! Just because I'm feeling super helpful, attached is that homepage image after I ran it through https://tinypng.com/ - much smaller (79% smaller in fact!) and there's only very slight differences as far as I can tell - they're there if you compare them side by side, but less obvious if you view this one on its own.1 point
-
So for the modified, just ignore it for now. Depends much on how Ryan will handle the modified date on module directory. Regarding the versions, the "modified date" wouldn't always mean the module has updated its version. It could as well be an readme update or just the maintainer updated the modules info page. ModulesManager only looks for the version of the module to mark an newer available version.1 point
-
1 point
-
On a template named 'horse' add two fields with the type of Page. (both Single page) Name one field 'father' and the other 'mother'. ( Allow new pages to be created from field?, Set to yes ) I advice you you use Page autocomplete (not installed by default) as horse lovers know all the horses by name Make both fields required (force the editor to fill it in), but then you have to create one "Null Horse". the selectable parent of the 'horse' is always 'horses', The Null Horse is a Page with template horse and it's not an existing horse. When they don't know their parent(s) they can select the Null horse. When the Null horse is reached it's end of the tree. // Structure for horses, all on the same level home | +-- horses (horses template) \ +-- abram (horse template) | +-- betty (horse template) | +-- cinderella (horse template) | +-- dromedary | +-- etc..1 point
-
That's a really nice site - fantastic work. My only comment as I'm typing this on a tablet with hi-res display is that the site is crisp in all areas except the map markers. I would suggest recreating them at twice the size and loading them at 50% size to counteract that. Everything else is perfect1 point
-
1 point
-
from: $page->parent; // what's my parent? to: $page->get(parent)->title; // retrieve the title of the parent page experimenting with: $page->get(parent)->fields; // take array from the template of the parents page itterating: $parentfields = $page->get(parent)->fields; foreach ($parentfields as $myfield) echo $myfield; // get field names from the template of the parent page and some: $page->get(modifiedUser)->name; // retrieve the name or like this: <a href='.$page->get(parent)->headline->url.'>'.$page->get(parent)->headline.'</a> // this way I can use a field value and link it to the page // ONLY THE URL IS WRONG... will check... // of course, it has to be : <a href='.$page->get(parent)->url.'>'.$page->get(parent)->headline.'</a> All fun so far! Type of code should be in a cheatsheet for newbies...1 point
-
fmgujju, The info at the top of the modules page should say something like: Modules found on modules.processwire.com (224) Maybe the file limit in the module's prefs is to low to check for all availabe modules? I had to increase the limit at my installations recently.1 point
-
Be aware of variable scoping $modules would be $this->modules For expiring the cache you should look for the right syntax, as MarkupCache files are separate folders, delete able by its name.1 point
-
$user isn't updated since you're in a template and $user was set before you execute this code. $users->setCurrentUser($u); echo "<br />After setting current user: " . wire("user")->name So the new current user would only be available via wire("user") or $users->getCurrentUser(), that will get the new current user.1 point
-
There's a plugin for DataTables that exports XLS: http://www.datatables.net/extras/tabletools/ Soma has created a module that let's you easily apply DataTables to your PW modules: https://processwire.com/talk/topic/5364-jquery-datatables-modulejs/1 point
-
1 point
-
Yes, normally every MarkupCache expires on any page save. You can disable this and then build your own caching logic with a hook on save() like Martijn suggested. So you tell it when to expire instead of when not to expire ...1 point
-
@adrian Just started using this on a test install and it's fantastic. I agree with Soma that being able to choose a template for the parent (container) page would be good as I can envisage using a common container template for different sets of children. I think your module would also benefit from allowing user override of the generated parent and child template names. For example, I'm going to be doing a site offering different gymnastic courses so a natural name for one of my containing parents is going to be 'Courses' which gives rise to the template name of 'courses' (which is fine) but I'd like the template for the children to be the singular 'course' rather than 'courses_items'. You could probably accomplish this by providing a field for the child template title and having it filled on-the-fly as the parent title is edited in the same way a page name is populated as the page title is entered (if not already edited by the user.) The workflow would then look something like... Enter the parent title: "Courses" (the child title automatically becomes "Courses Items" by default.) Edit the child template title, changing it to "Course". Fill in the rest of the page & submit giving parent template title: "Courses" and name: "courses", child template title: "Course" and name "course". In this way, users could title and name the parent and child templates as needed. The child template title field could be collapsed by default as it can safely be ignored if the user isn't picky about the child template title/name. Not sure how easy or difficult this might be but having a way to specify field types when using option 2 might be useful too. Maybe something like... Title, Min Age>Integer , Max Age>Integer, Gender Though there will be better ways to express this. I'll keep playing and post again if anything more comes to me.1 point
-
prev and next look for a the prev and next pages inside any pageArray, if you use it with the same array that you used to build your posts list, it will respect that order.1 point
-
Something like?: //populate a PageArray $articleList = $pages->find("template=article, limit=25") //next $page->next($articleList) //prev $page->prev($articleList) This assumes your articles have their own template. You can put more options, like sort, in the page selector. The http://cheatsheet.processwire.com/ is always a nice thing to check for options available.1 point
-
@Joss : Thank you! it's awesome. you're quite a writer! Btw we are planning to get some Irish oysters @fmgujju : Everything is PW. I think that PW is the only CMS that would allow me to do such a website in 5 days1 point
-
Quick one as I gotta run...$page? collision? That is a known property in PW....Just guessing .....1 point
-
No worries - I haven't revisited this one in a while, so please let me know if you think of any improvements. I know the soma is not keen on the fact that currently you can't reuse templates as each new page field creates a new paired set of parent/child templates. So maybe I should aim to add an option for that, but I am definitely curious to hear your feedback.1 point
-
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.1 point
-
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(); }1 point
-
It's like diogo said. My prefered way to work (I'm also a PHP noob like you): build a static website in html and css. Or at least make some demos with the desired structure/layout. There I can do all the responsiveness and other stuff. After that I split the parts/files to make the templates etc. The rest is doing echo, if and foreach... Try to make it as simple as possible in the beginning. So you don't have to find out, what others have constructed in the ready made site profiles.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
-
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
-
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.1 point
-
1) if you have ip that can change during one session (very common with mobile connections for example) you need to turn off the session fingerprint from site/config.php1 point
-
What you can also use, where PW does its validation is the processInput() of inputfields. You can hook into it and do you validation and add errors as needed. $form->addHookAfter("processInput", null, "formValidation"); function formValidation($event){ $form = $event->object; $email_inputfield = $form->get("email"); if($email_inputfield->value == "spam@hotmail.com"){ $email_inputfield->error("We got you!"); } } // direct on the inputfield type wire()->addHookAfter("InputfieldText::processInput", null, "validatText"); function validateText($event){ $inputfield = $event->object; if($inputfield->name == "username"){ ... } } And there's also the HTML5 regex pattern that can be used.1 point
-
What I use in front end from is doing my own validation when needed, some fields are already validated like password inputfield or email inputfield. On a register form I have something like this for example, combined with jquery validation for client side validation... if($input->post->register) { // processes form, validates and add error messages to fields $regform->processInput($input->post); // check email unique if any if($sanitizer->email($regform->get("email")->value) != '') { if(!$helper->isUniqueUserEmail($regform->get("email")->value)){ $regform->email->error(__("Diese E-mail wird bereits verwendet.")); } } // check username format only a-z0-9-_. $username = $sanitizer->pageName($input->post->username, Sanitizer::translate); if($username != $input->post->username){ $input->post->username = ''; $regform->username->error(__('Benutzername ist nicht im richtigen Format.')); } // check if username ($user->name) unique if(!$helper->isUniqueUsername($username)){ $regform->username->error(__("Dieser Benutzername wird bereits verwendet.")); } if(!count($regform->getErrors())){ ... I have helper functions like isUniqueUsername etc, that is at the same time used in jquery validation via ajax. Depending on your knowledge and how fluent you are with PHP and PW, I find it easy to add my own methods or checks where needed and found use of any external validation class not needed (was using that before).1 point
-
All inputfields are sanitized, except for password. If you want to sanitze and not really validate. ProcessWire has the $sanitizer. I do use the $sanitizer->email($value) sanitizer as validator to, as it blanks out invalid adresses. if (!$sanitizer->email('bweugh')) { echo "Oops I'm something else"; }1 point
-
1 point
-
I just (like 5 mins ago) implemented "Most Viewed Pages" widget for a client. I used Wanzes excellent ProcessGoogleAnalytics module and it was easy enough pull data when it was first setup. It might be that this is not a fit for your project Martijn (if you need the data for selectors for example), but this is how I did it: $pga = wire('modules')->get("ProcessGoogleAnalytics"); $ga = new GoogleAnalyticsAPI(); $ga->auth->setClientId($pga->clientId); $ga->auth->setClientSecret($pga->clientSecret); $ga->auth->setRedirectUri($pga->page->httpUrl); $ga->setAccessToken($pga->accessToken); $ga->setAccountId($pga->accountId); $defaults = array( 'start-date' => date('Y-m-d', strtotime('-1 month')), 'end-date' => date('Y-m-d'), ); $ga->setDefaultQueryParams($defaults); $params = array( 'metrics' => 'ga:pageviews', 'dimensions' => 'ga:pagePath', 'sort' => '-ga:pageviews', 'max-results' => 11, ); $visits = $ga->query($params); $out = "<h2>Most read articles</h2><ul>"; foreach($visits['rows'] as $row) { if ($row[0] == "/") continue; // Skip the homepage, should be on top 10 always, if not, then 11 articles is shown $p = $this->pages->get($row[0]); if ( ! $p->id ) continue; // For some reason page is not found anymore... $out .= "<li><a href='$p->url'>$p->title</a></li>"; } $out .= "</ul>";1 point