Leaderboard
Popular Content
Showing content with the highest reputation on 01/08/2013 in all areas
-
Hi folks - I've upgraded the software successfully this time and applied the new theme to match the new version of the site. I've noticed one or two minor tweaks since doing this so I'll be making some minor adjustments this evening, but other than that it should be fine.4 points
-
Hi all, I just wanted to let you know that I've implemented the solution you helped me out with above, and it works wonderfully. I now have a site ready to move from development to production. I can't believe how easy it has been with Processwire. I've been able to implement things that were just way too hard to bother trying to do in some other CMSs. Again. Thanks for all your help!4 points
-
Hi Guys!, When i'm developing some Modules usually i use the Admin interface for try/adjusting the configuration of all the objects ( Templates, Field, Pages ). So at the end i need to use the ProcessWire API for create each of those objects... and it is difficult (for me) to translate all on code, because some Fields/Templates can have a particular configuration and sometimes i really don't remember all the names of the parameters It will be useful (maybe) to have a button to export all in PHP code to copy/paste in the Module. USSliberty2 points
-
2 points
-
Upgrading forums always reminds me of servicing my first car when I was a teen - I always ended up with more screws than I seem to have places to put them. I nearly blew up the Mark II Escort GT I had. (1300cc of raw lettuce leaf) So, I will be listening out to see if the forum starts rattling or pinking or something. The timing always seems to out a little when you first restart it .....!2 points
-
From by brief scan of this topic (I keep falling behind) I'm with diogo in that it wouldn't be too hard to import them with a script and use the API to put them into ProcessWire as pages, use the date from the folder as the published date and then you have a nice, structured database for your news stories with search functions and a date-based archive. I've imported something that sounds a lot harder than what you're after, so if you have those nice tags like <!-- Text --> to delimit different parts of content it should be relatively simple. Is there any chance you can provide an example article? Also if there are associated images with some of them, are the image files names sensibly or are they just in the folder with the text file (i.e. one folder per article - I think they would be looking at your first post)? If you don't want to post something on the forums but dont mind sending it my way then feel free to PM me and I can have a quick look.2 points
-
The Modules page can get a little unruly, and though Soma's ModulesSectionCollapse helps to mitigate this I felt the need for more.... So I put together "Modules Quick Filter". Which has two main components. A "search as you type" field that filters by module name and a "refine by category" select box, which narrows the display of Modules by category. (The functionality is accomplished with javascript, as is the layout itself, if there are some hooks I could've used to do this, someone let me know ) UPDATE 1.1 - Added Multilingual Support and some minor bug fixes/improvmtents UPDATE 1.2 - Added configuration setting to choose whether or not field is collapsed by default. DOWNLOAD2 points
-
The statement you have wrote is wrong itself if you can make demo like the one you made yourself! Kudos!2 points
-
@Nicole. The code Ryan provided are examples that archive what my code does, but using direct SQL queries with $db var. $result = $db->query("SELECT COUNT(*) FROM field_comments WHERE status=0"); list($numPending) = $result->fetch_row(); echo "<p>There are $numPending comments waiting approval</p>"; This does the same as my code example. It's just much more efficient to do it this way with direct SQL query. "field_comments" would be the "comments" field. Each field you create has a table with it's name in the database. Ryan just gave those examples because there's no implementation in the API that would do this ATM, so my code is kinda an not so effective version of it as it has to loop through all pages that have comments. This is no problem with smaller sites, but the more pages with comments there are the slower it would get. While it should work well up to couple hundreds of pages, Ryan's method would scale up to hundred thousands pages easily before getting any noticeable impact.2 points
-
Hey, I just thought it might be helpful to have a guide for your module's presentation: The Title The title of a module is an important part of it. It should kind of make the main function of a module understandable after the first reading. So there are some guidelines for naming a module: (via http://processwire.com/api/modules/) Here is a more extended list of some "module prefixes" and a short description for each: (via http://processwire.c...-module-naming/) The Description A good description is another important part of your module's presentation. Here is a short list of sections you could (or maybe should) include in it: General: The main function of your module How to use: A description of how to use your module which maybe includes some details the user won't see directly. Installation: If there is something special about the installation of your module you should add this to your description. Screenshots/-casts: It's awesome if you would take a picture of your module (if it changes or adds something the user is able to see). Or maybe a screencast if you like to. (Great example: http://processwire.c...ncy-admin-mode/) Links At the end of your post you should add some links like where the user can download the plugin and if you've added your module to the module section you should post the link here too. Module Section If you've posted your module already to the modules section you can easily copy it's contents there and use them for your post here or - of course - the other way around. I hope this post was helpful to you. Greets, Nico1 point
-
I found (after 2-3 Projects using PW) that it's a good technique to use templates in a way I think hasn't been thought of yet really by some. (Although the CMS we use at work for year, works this way.) I'm sure I'm maybe wrong and someone else is already doing something similar. But I wanted to share this for everybody, just to show alternative way of using the brillant system that PW is. Delegate Template approach I tend to do a setup like this: - I create a main.php with the main html markup, no includes. So the whole html structure is there. - I then create page templates in PW without a file associated. I just name them let's say: basic-page, blog-entry, news-entry... but there's no basic-page.php actually. - Then after creating the template I make it use the "main" as alternative under "Advanced" settings tab. So it's using the main.php as the template file. - This allows to use all templates having the same php master template "main.php" - Then I create a folder and call it something like "/site/templates/view/", in which I create the inc files for the different template types. So there would be a basic-page.inc, blog-entry.inc ... - Then in the main.php template file I use following code to delegate what .inc should be included depending on the name of the template the page requested has. Using the TemplateFile functions you can use the render method, and assign variables to give to the inc explicitly, or you could also use just regular php include() technic. <?php /* * template views depending on template name * using TemplateFile method of PW */ // delegate render view template file // all page templates use "main.php" as alternative template file if( $page->template ) { $t = new TemplateFile($config->paths->templates . "view/{$page->template}.inc"); //$t->set("arr1", $somevar); echo $t->render(); } <?php /* * template views depending on template name * using regular php include */ if( $page->template ) { include($config->paths->templates . "view/{$page->template}.inc"); } I chosen this approach mainly because I hate splitting up the "main" template with head.inc and foot.inc etc. although I was also using this quite a lot, I like the delegate approach better. Having only one main.php which contains the complete html structure makes it easier for me to see/control whats going on. Hope this will be useful to someone. Cheers1 point
-
Just recorded a video of a larger Site I've done some already know of (in this forum). Since a long time I wanted to share something, that maybe of use to others, so here it goes. It shows some technique I use often to give shortcuts to editors when editing content on the page. It's ideal to use for summary entries to give them a direct edit link, or for data pages that have no real view and are located somewhere else in the page tree. Basicly it's simple and just requires to add Fancybox js to the front-end, and you may already have it, or if now use another lightbox that has iframe capabilities. Also if there's not lightbox plugin you need in the site, just load them conditionally using $user->isLoggedin() check. Then generate simple edit buttons/link where you like, and add a "?id=1001" to the url PW admin edit url (/processwire/page/edit/). You can do this without fancybox modal as the default basic-install shows, but using fancybox can make the experience a lot better. To have the navigation of the admin not shown you just add a &modal=1 to the url. Code to generate the year link seen in the video is: if($user->isLoggedin()){ foreach($chart_years as $year){ if($year->editable()) { // if editable by user. echo "<a class='editpage-inline' href='http://" . $config->urls->httpHost . $config->urls->admin . "page/edit/?id=". $year->id ."&modal=1'>edit ".$year->title."</a> "; } } } Then in your JScript you would add fancybox functionality to the links like this. $('a.fancybox-iframe, a.editpage-inline').fancybox({ type: 'iframe', centeronscroll: true, autoScale: true, width: 900, height: '80%' }); Minimal effort, maximal effect.1 point
-
Hi folks Anyone who's tried logging in for the past hour or so will have seen a message saying we were upgrading the forums. Unfortunately everything that could go wrong did go wrong, but I've put everything back to how it was now and you can discuss ProcessWire once again For those that are interested, what worked fine on my local copy simply failed to work when I tried merging it with the liver version here - something to do with the merging routines in the new version of the forum software and/or something I've overlooked. I'll re-visit it at a later date and, having learned my lesson, I'll try and get it working in a sub-forum on the live site before taking the forums offline again. Apologies for the interruption!1 point
-
Fancy Admin Mode Just had a little funwith fancybox iframes, and created a little module that opens all admin links (topnav links, edit, view, new, copy actions) except "Pages" screen and "Site", "Search" in a FancyBox, so you'll never leave the page tree. It even works with inherit editing child pages. Download: https://github.com/s.../FancyAdminMode Little screencast to se it in action:1 point
-
This is a profile I am creating for my own use (though I will make it available once a lot of the kinks are out of it) It is still Work In Progress! http://pwdemo1.stonywebsites.co.uk/ This is basically creating a CMS that would be familiar to users of Joomla and similar where a lot of the information is contained in blocks. Perhaps it should be called "Process-Drumlapress" It is also designed to be very localised where many "front" pages can be created reflecting postcodes in a local area and where a phone number is pushed heavily. It will contain a lot of SEO tools throughout - the PW page naming and URL base is really useful here! This is a Twitter Bootstrap based site, though I admit I need to tweak it a bit to get it working completely smoothly. There is a central site settings page where many bits can be configured: Above and below content global banners can be chosen some common side bar blocks can be chosen Common footer information can be added Site name and top banner can be added Bottom blocks can be selected from a list and their width as a span number added Blocks can enable/disable display block title And other bits and pieces. Each page created can choose whether to select the Global Above or Below banner, no banner or a custom banner text box. Each page can choose from additional sidebar blocks Each page can add an additional sidebar text block Products and Services work on a very simple category system where you create a category page (just for a Select option). You then create a display index for the category where you fill in some intro information and choose a category. That will automatically create a list of all products or services linked to that category. (At some point I would like to customise the admin to put some of these links and create buttons on the top menu, rather than navigating through the pages list). The Gallery used Fancy with a carousel - thanks for the Thumbnail module! The front slide show allows text to be laid over the images. Still to do: Add pagination to things like products and news Create a setting so the fixed footer can be un-fixed or removed Add some additional block customisation like border and background color/image Clean up some of the admin fields and improve labelling Sort out the admin permissions properly (they are a bit drunk at the moment) Clean up some of the template files The overall look of the site is intentionally basic and some of the CSS values (like padding and margins) are default rather than pretty. This is intentional as this meant to be a starting point rather than a plug-and-play profile - in other words, it would need to be customised for the specific client. The intention here is that you can change the structure of the site to a certain extent with just a few files without having to change the back end administration at all (though, some thumbnail sizes would possibly need to be changed. Edit: Forgot to mention a couple of tricks: The bottom blocks use JQuery so they are equal height all the time I have used JQuery to place an optional second image in a news article which counts the number of paragraphs for an insertion point. This means I do not need to use the image button in the TinyMCE. Edit 16/01/2013: Just updated the site a little. It now runs on 2.3 News can be sorted by year and has grown itself Bootstrap styled pagination. There are now potentially three rows of blocks at the foot of the site, which looks a bit mad at the moment, but in reality you would have one row of blocks, the next row perhaps a banner and the last row a normal footer. You can select blocks from a library and choose how many in each row and the span size of each. You can also select background colours for blocks. In the backend the forms are sorted out a lot more into tabs and field sets to make them neater - especially the Site Settings page which has a lot of parameters now. I have used Soma's wonderful Teflon Theme, but added a different, customised JQuery UI theme and changed the menu styles to suit my partner for her site. Other than that, it is as original. http://pwdemo1.stonywebsites.co.uk/admin1ss.png http://pwdemo1.stonywebsites.co.uk/admin2ss.png Next to do: Put some better content in it for demo purposes Create a second site using the same basis, but change the template round a bit.1 point
-
I was thinking of a way of creating custom admin pages without having to create a process module or having to use the $wire object. I came up with a process that is actually very simple (although I think it would be better to create a module for having this functionality). Here is how: (This will work with the default admin theme, but should also work with other themes) Go to your /site/templates-admin/default.php (if you don't have it, copy the /wire/templates-admin/ directory to /site/) and change this line <?php echo $content?> to this <?php if($page->template===$templates->admin){echo $content;}else{include($config->paths->templates.$page->template->name.".inc");}?> Then, go to the /site/templates/ folder and create a file named "custom.php" with this content <?php include($config->paths->adminTemplates."default.php"); Our setup is ready Now, to create a custom page in the admin: First, create the new page as child of /Admin/ and point to custom.php as the template file. To do this, when creating the template for the page, go to "ADVANCED" and write "custom" as the "Alternate Template Filename". Then, instead of creating a TEMPLATE.php file, as you normaly would, create a TEMPLATE.inc file. You can use all the API variables as you would in a normal template. Disclaimer: This is a proof of concept, and has still lot's of place for improvement. edit: changed from this if($page->process) to this if($page->template === $templates->admin)1 point
-
Sounds like IP.Board doesn't make their upgrades very easy. Thanks for your time and expertise in getting us up to date. I'm really liking the new look. One minor point I wanted to mention is that the edges of the masthead are flush on either side of the screen when they should be padded at least 10-15 pixels or so like the rest of the interface. Screenshot attached.1 point
-
I think that might be because you're a moderator but I'm not sure. I'm removing access to the old one so it should move any stragglers over to the new one automatically.1 point
-
It shouldn't be too difficult to come up with a script to import the text in the flat files to pw pages.1 point
-
In Portugal we have an expression "giving us music" that means "playing with us" or "trying to full us". In this case it applies beautifully1 point
-
How do you wanna solve this Matthew? By module or by template file? If (by template) echo 'Luis got code snippet'1 point
-
1 point
-
If you do use SSL certs for parts of the site, and if those parts are not 'public' you could try using self-signed certs as you probably don't need to go to the expense of getting anything fancy from a "trusted" third party.1 point
-
haha, thanks Willy! I have new favorite artist and definitely inspiration for my personal endeavor in music.1 point
-
1 point
-
1 point
-
We haven't accounted for a site-wide count in the API. But you could still do it fairly easily with an SQL query: $result = $db->query("SELECT COUNT(*) FROM field_comments"); list($numTotal) = $result->fetch_row(); echo "<p>There are $numTotal total comments</p>"; $result = $db->query("SELECT COUNT(*) FROM field_comments WHERE status=0"); list($numPending) = $result->fetch_row(); echo "<p>There are $numPending comments waiting approval</p>"; $yesterday = strtotime("yesterday"); $result = $db->query("SELECT COUNT(*) FROM field_comments WHERE created>=$yesterday"); list($numNew) = $result->fetch_row(); echo "<p>There are $numNew new comments posted since yesterday</p>";1 point
-
My thoughts about pw: If you just started with pw, maybe you created your First Page and saw how pw Works and handles data you think uh yummi nice CMS. Well thats fine and correct,pw acts, feels and looks like a CMS. You then dig deeper into the API, you understand how the different fieldtypes are working and you get a good overview. You probably think at this point: could I use pw like a Database? You Set your first page relation, count the arrays and you Play with the Data and you think: WTF!? Is this still a CMS? The longer you use pw, the deeper understanding of the API, you finally realise which great,strong and powerfull toolset Ryan just handed right into your hands. At this particullar point the term CMS would not come to your mind anymore. PW could be used like phpMyAdmin, just create tables,rows and data and work with them, but a Way more easier without even knowig what MySQL really is. Some of you might know my Intranet Application i'm working on, this is all made with pw and some little template php scripting. The next days I will Show a Little preview of an App i'm also working on, and yes everything PW driven.1 point
-
No problem, I have added this and it should appear on the dev branch on the next commit.1 point
-
One of my clients specializes in putting on conferences/summits around the world, primarily focused on architecture and sustainable design. I mentioned to them how some users here (starting with Netcarver) had expressed interest in a ProcessWire meetup or conference in the UK. This client does conferences in the UK every year and they are extremely enthusiastic about ProcessWire and interested in helping us to put on a conference by letting us collaborate with their conference and share the same venues and accommodations. This would help us benefit from their expertise in putting on conferences (which they've done for more than a decade), as well as help [significantly] on costs in reserving the venues, food, hotels. I have worked with this client since 1994 (18 years), so have a very high level of trust with them. The conference would be in August 2013 and be 1.5 days in London at a major ad agency, then we'd step on a train for an hour or so and do the rest of the conference in Cambridge at Kings College for another 1.5 days (total 3 days). This would be a small but relatively formal conference with presentations and workshops covering everything ProcessWire, design and web development. We'd cover topics at a higher level than you'd find anywhere else in the world. I don't yet have an idea on costs except to say that we'd find a way to make it accessible to as large of an audience as possible, and it would be completely non profit, food and accommodations (for those that wanted it) included. Yet, it'd still be higher class and more personal than any other webdev conference. This is about a year out, so I'm interested in finding out who'd be interested in this. Please 'like' or reply to this post if you would be interested in attending (or presenting) at this conference.1 point
-
That's a good example sinnut, but a minor change to make it work: public function afterSave($event) { $page = $event->argumentsByName('page'); // get argument by name, more readable if($page->is(Page::statusUnpublished) || $page->publish_date) return; $page->publish_date = time(); $page->save('publish_date'); } isset() wouldn't work in the previous example as the field exists but is not populated it will always return true. Also $page->of(false) isn't really required as in a module the page has no outputformatting on anyway. To populate the datetime field you'd just give it a timestamp. As the field holds input-outputformatting date formatting it will take that. Not wrong but no need to. If you also need to restrict to certain pages you could add a check for the template before status check. if("article" == $page->template) return;1 point
-
I don't have coding skills but if you have some this would be an easy module i guess. Something like: /** * * "Set Publish Date" module * */ class SetPublishDate extends WireData implements Module { /** * getModuleInfo is a module required by all modules to tell ProcessWire about them * * @return array * */ public static function getModuleInfo() { return array( 'title' => 'Set Publish Date', 'version' => 001, 'summary' => 'your summary', 'singular' => true, 'autoload' => true ); } /** * Initialize the module * * ProcessWire calls this when the module is loaded. For 'autoload' modules, this will be called * when ProcessWire's API is ready. As a result, this is a good place to attach hooks. * */ public function init() { // add a hook after the $pages->save $this->pages->addHookAfter('save', $this, 'afterSave'); } public function afterSave($event) { $page = $event->arguments[0]; if($page->is(Page::statusUnpublished) || isset($page->publish_date)) return; $page->of(false); $page->publish_date = date('Y-m-d H:i:s'); // not sure about the date format $page->save('publish_date'); // save only specific field like this? } } Perhaps someone more experienced can help you out1 point
-
Also wanted to add this as a disclaimer for this forum: Any arrangement for work made via this board is a private contract between the individuals concerned. ProcessWire and Ryan Cramer / Ryan Cramer Design, LLC or any of its agents cannot be held responsible for the operation of that contract or any of the financial arrangements and will not get involved in any disputes under any circumstances. If it goes wrong for any reason, it should be sorted away from this community. Thanks to Joss for the suggestion and wording.1 point
-
1 point
-
1 point
-
Sneaky Niki you. I didnt even notice this thead before. Nice! Havent tried but at least a dozen optones are missing. ;-)1 point
-
I'm on a mission! Trying to give back after all the millions of questions I've asked myself....1 point
-
Not to completely hijack this thread, but... you may wish to read this: http://www.cmscritic.com/critics-choice-for-best-free-cms-goes-to/ I've sent Ryan the badge below for ProcessWire.com if you feel like showing it off1 point
-
Here are some more recent 2.3 additions that are currently in the dev branch. This list is far from complete, but covers the more interesting ones: Admin Theme The default admin theme now handles long titles better. If you are editing a page with a really long title, it will dynamically reduce the size of the headline in the admin theme so that it can fit. After a certain point, if it still won't fit, then it will wrap it. If you try to make a headline as long as a paragraph, then you are on your own though. Inputfields Added the 'side-by-side' (inline) option to Checkboxes and Radios Inputfields. This lets you have them all display on one line, floated, rather than placed in columns. To do this, specify "1" for the optionColumns setting. Added ability for PageEditImageSelect to select images from within repeater fields on a page. Update InputfieldDatetime to support i18n jQuery UI translation files with the datepicker. TinyMCE: Add config option to ProcessPageEditImageSelect enabling you to turn off the population of width/height attributes in TinyMCE inserted images. This is desirable for responsive images. To configure this go to Modules > Process > Page Image Select. Sanitizer Added new $sanitizer->entities($str); method, which is the same thing as htmlentities($str, ENT_QUOTES, 'UTF-8'); Added $sanitizer->emailHeader($str); method that does what it says (sanitizes an email header). $sanitizer->url(); will now optionally accept query strings. Comments Fieldtype Add new 'redirect after post' option which makes the Comments form perform a redirect after a comment is submitted. This prevents the possibility of duplicate submissions and enables the user to see their posted comment immediately (when applicable). To enable, see the 'details' tab of your comments field. You can now search the contents of comments fields from $pages->find() selectors in the same way you search text fields. Example: $pages->find("comments*=some text"); Added new 'website' field option to comments fields. To enable, check the box in your comments field 'details' tab. Added Gravatar support to comments fields. To enable, select the Gravatar rating in your comments field 'details' tab. Added option to not send notifications to admin when comment is detected as spam. Some of us were getting dozens of emails a day from spam bots making the rounds through our sites, so this prevents that from annoying us. Added new gravatar() method to Comment class that returns the Gravatar image URL (this is a convenience for those implementing their own comment output). File and Image Fieldtypes Add new 'tags' option to FieldtypeFile. This gives you the option of specifying a 'tags' field with each file/image. From the API, you can then retrieve a files/images by tag using $page->files_field->getTag('some-tag') to retrieve first match or $page->files_field->findTag('some-tag') to retrieve all matching files. Previously you could only retrieve files/images by filename or index. You can also use "[field_name].tags=[tag_name]" in $pages->find() type selectors. To enable tags for any files/images field, see the checkbox on the field details tab. (Note that this also affects InputfieldFile, Pagefile, Pagefiles, FieldtypeImage, InputfieldImage, Pageimage, Pageimages). Add support for secured pagefiles. Now unpublished or non-public pages may have their files (in /site/assets/files/...) protected from direct URL access. For existing installations, you need to add $config->pagefileSecure = true; to your /site/config.php in order to enable this capability. See also $config->pagefileUrlPrefix and $config->fileContentTypes in /wire/config.php, if interested. Files become secured when the page is not accessible to the 'guest' role. Functions/Methods Add new methods to WireArray class: replace(), findRandom() and findRandomTimed(); Name of the last one may change to findRandomInterval before 2.3 is final. Add new wireRmdir() function, to go along with the existing wireMkdir(). The wireRmdir() function works the same as PHP's rmdir() except that you can specify a second boolean argument to make it recursive. This essentially results in a directory prune function that not just removes the directory, but everything in it, recursively. Be careful with this! Add new wireSendFile($filename); function that works as a file passthrough script. This is used by the new secured file functions, but also available for your use should you want it. Add new wireRelativeTimeStr("timestamp or date string"); function that provides a relative time string like "1 minute ago" or "10 hours ago" or "5 minutes from now" type string.1 point
-
Thanks Lance! For people that want to donate, one good way might be to maintain a PPC campaign promoting ProcessWire, or to advertise on a site like cmscritic.com or others. In the past, we've also done PW feature-sponsorships, where a company can sponsor some or all of the cost of developing a new feature or module for ProcessWire (see Avoine). Ultimately, if there are donations I think it would be great to have them go directly towards growing ProcessWire's user base or capabilities.1 point
-
Do you get paid for the sites that you would with PW? When you come to the forums to get help, do you limit your questions purely to development work that you are doing for free? I originally developed PW to help us all create better sites in less time, and with more fun. I'm hoping that PW is helping others to be more competitive in all ways, including financially. But recognize that PW did not come into existence on its own. Years worth of time and money has gone into making ProcessWire happen. If you are using ProcessWire to develop sites you get paid for, then you are profiting from ProcessWire. And that's fine with me, no ROI is expected or wanted--I've never asked anyone for anything. But it is disheartening to hear a user make a statement with the implications yours makes. Form Builder is not about making a profit. I don't expect that I will ever make enough on it to offset the actual time investment on it. My hope is that eventually it will be something where the community and myself have split the cost to create. If I wanted a profit, I would go make a Form Builder for WordPress or Drupal where the user base is large enough for that potential to exist. Form Builder is a tool that wouldn't exist if I had to fully self fund it. It's also an experiment to determine if I can reduce my client workload and substitute some of it with ProcessWire-related development that benefits all of us. But I can't substitute something that supports my family with something that doesn't. Form Builder is here to benefit you, not me. If you build sites for a living (or even a hobby) it's going to pay for itself the first time you use it. If you previously spent half a day building a form, now you can spend minutes and get a better, more secure and capable result that can do all sorts of things with the results it collects. Also want to note that Form Builder is something completely different from the original subject of this thread and I don't view them as similar products at all. Likewise, Form Builder is completely different from something like Zend Form or others like it. One does not preclude the use of the other and we should all keep more than one tool in our forms toolbox. I fully support Clinton's project and any others that benefit forms in ProcessWire. Forms are one of the most diverse and important aspects of web development. I feel very confident about the value of Form Builder in your toolbox, so have made it 100% refundable if you find it isn't for you (this type of return policy is pretty rare with digital products).1 point
-
1 point
-
1 point
-
Hello to all, Here is our travel site running Processwire: Lentovertailu.fi We use custom javascript+php code for comparison script and it works well in the template header. The articles use automatic resizing of images which helps a lot. Maintaining the site is effortless and the CMS offers a great base for expanding the site later. I recommend Processwire for my customers too.1 point
-
Hi Tina, Your steps cover most of the process. A few notes: Make sure that the files/folders in the assets folder are writable Make sure to copy the the .htaccess file to the root of your website (some FTP programs hide this file by default) I prefer to delete the contents of the /site/assets/cache folder, but I am not sure if it's needed. You can do this before uploading the site, just to safe time. If you are going to use a new sql database, you can change the name and the user in the site/config.php file. For future use, for example if you want to copy the production database to your local mamp installation, make sure you add "drop tables" to your export, otherwise you will get errors about existing tables. That's all I can think of now. And if something should go wrong.... these forums are here to help you. 8) /Jasper1 point
-
This doesn't work because $page->children is an array of pages (PageArray), not a Page. Think of it like a boat carrying a bunch of people. The boat can't have children, but the people in it can. I'm also not sure $page->children->children would be all that useful, because they would have lost all sorting context. However, I'm only thinking in context of the sites I make and know everyone has different needs. So if you want to have something equivalent to $page->children->children, it would be $page->find('id>0'). But I would suggest using Soma's examples as they are more specific to a template, and it's better to be specific. Nearly any search that gets passed through a selector is fully indexed, so it doesn't have to scan the whole site. If you put in "template=video" it [mysql] heads straight to an index of pages with the video template, so it's not scanning or considering other pages. You'd want to limit that if you were using the video template elsewhere in the site and didn't want videos from one branch getting mixed in with videos from another. However, if you know where you are using the video template and aren't going to be using it on other branches in the site, there's no speed advantage to performing the search within a parent $page rather than just using $pages->find() to do it. Technically, there's slightly more [minor] overhead doing a $page->find() than a $pages->find() because it's adding a lookup table to the search that may or may not need to be there.1 point
-
Thanks for posting Soma, this is an interesting approach and not one I've seen before, but it looks great. The underlying concept and result is similar to the approach I usually use. Since you posted a good description, I'll try to do the same for mine. The only reason you see head/foot files in the default PW profile is because it seems to be simpler for new users to grasp. But I almost never use that approach in my own sites. Like your system, I have a main.php file which is my main markup file. But unlike your system, main.php is included from all the other template files (rather than main.php including them). The other template files focus on populating the key content areas of the site, specific to the needs of the template. Examples of key content areas might include "main" (for center column/bodycopy) and "side" (for sidebar/related info), though often includes several other identified areas. But I'll keep it simple in this case. Here's how it works: basic-page.php <?php $outMain = "<h2>{$page->subtitle}</h2>" . $page->body; if($page->numChildren) $outMain .= $page->children->render(); // list the children $outSide = $page->sidebar; include("./main.php"); main.php <html> <head> <title><?php echo $page->title; ?></title> </head> <body> <h1><?php echo $page->title; ?></h1> <div id='main'><?php echo $outMain; ?></div> <div id='side'><?php echo $outSide; ?></div> </body> </html> The benefit of this approach is that basic-page.php can setup whatever it wants in the key content areas ($main or $side) whether simple like in this example, or something much more complex. I actually prefer for the variables representing the key content areas to be optional. In the scenario above, $outMain and $outSide would have to be defined by every template or they would end up as uninitialized variables in main.php. As a result, I actually use $page as an anonymous placeholder for these variables (making sure they don't conflict with any existing field names) and then let main.php assign defaults if the calling template didn't specify one of them. For example: basic-page.php <?php $page->outMain = "<h2>{$page->subtitle}</h2>" . $page->body; if($page->numChildren) $page->outMain .= $page->children->render(); // list the children // note: no $outSide specified include("./main.php"); main.php <?php // setup defaults when none specified if(empty($page->outMain)) $page->outMain = $page->body; if(empty($page->outSide)) $page->outSide = $page->sidebar; ?> <html> <head> <title><?php echo $page->title; ?></title> </head> <body> <h1><?php echo $page->title; ?></h1> <div id='main'><?php echo $page->outMain; ?></div> <div id='side'><?php echo $page->outSide; ?></div> </body> </html> Final thing to point out here is that main.php is the only template actually outputting anything. Because basic-page.php (or any other template) is determining what's going to go in that output before it is actually sent, your template has the opportunity to modify stuff that you might not be able to with other methods. For instance, the <title> tag, what scripts and stylesheets are loaded, etc. Here's the example above carried further to demonstrate it: basic-page.php <?php // make a custom <title> tag $page->browserTitle = $page->rootParent->title . ": " . $page->title; $page->outMain = "<h2>{$page->subtitle}</h2>" . $page->body; if(count($page->images)) { // display a clickable lightbox gallery if this page has images on it $config->scripts->add($config->urls->templates . "scripts/lightbox.js"); $config->styles->add($config->urls->templates . "styles/gallery.css"); $page->outMain .= "<ul id='gallery'>"; foreach($page->images as $i) { $t = $i->size(100,100); $page->outMain .= "<li><a href='{$i->url}'><img src='{$t->url}' alt='{$t->description}' /></a></li>"; } $page->outMain .= "</ul>"; // add a note to $page->title to say how many photos are in the gallery $page->title .= " (with " . count($page->images) . " photos!)"; } if($page->numChildren) $page->outMain .= $page->children->render(); // list the children include("./main.php"); main.php <?php // if current template has it's own custom CSS file, then include it $file = "styles/{$page->template}.css"; if(is_file($config->paths->templates . $file)) $config->styles->add($config->urls->templates . $file); // if current template has it's own custom JS file, then include it $file = "scripts/{$page->template}.js"; if(is_file($config->paths->templates . $file)) $config->scripts->add($config->urls->templates . $file); ?> <html> <head> <title><?php echo $page->get('browserTitle|title'); // use browserTitle if there, otherwise title ?></title> <?php foreach($config->styles as $url) echo "<link rel='stylesheet' type='text/css' href='$url' />"; foreach($config->scripts as $url) echo "<script type='text/javascript' src='$url'></script>"; ?> </head> <body> <h1><?php echo $page->title; ?></h1> <div id='main'><?php echo $page->get('outMain|body'); // use outMain if there, or body otherwise ?></div> <div id='side'><?php echo $page->get('outSide|sidebar'); // use outSide if there, or sidebar otherwise ?></div> </body> </html> More than half the time, I'll actually just re-use page variables like $page->body and $page->sidebar rather than $page->outMain and $page->outSide. That way there's no need to consider defaults, since $page->body and $page->sidebar untouched technically are defaults. <?php $page->body = "<h2>{$page->subtitle}</h2>" . $page->body . $page->children->render(); But technically you've got a little more flexibility using your own self-assign anonymous variables like outMain and outSide, so figured I'd use that in the examples above. outMain and outSide are just example names I came up with for this example and you could of course name them whatever you want.1 point