Leaderboard
Popular Content
Showing content with the highest reputation on 11/28/2012 in all areas
-
Hi guys, I'm Marco, Italian IT technicians and PHP developer. In the past I've used Symfony, Wordpress (and Drupal, Joomla, ..).. in this days I try to come close to EE2.. but these aren't a good days for EE2 community. I read about PW from a tweet, and now.. Have a nice day, Marco4 points
-
Pattern support is now in place for text fields (dev branch). The pattern applies both client side (HTML5 pattern attribute) and server side, for the validation. I looked through all of those patterns are html5pattern.com and couldn't find any that weren't PCRE compatible. So if it's not 100% compatible, I sure can't tell the difference. My guess is that HTML5 patterns are compatible with PCRE, but some of the more advanced PCRE stuff (maybe atomic grouping or negative lookbehind?) might not be compatible with HTML5.3 points
-
The skyscraper profile updates are actually one of the next things on my list. A half day is all I need. I plan to make some upgrades to it at the same time as well.3 points
-
2 points
-
Sounds good guys, I'm going to go with a slight modification to Joss's suggestion: Will also append a blowfish hash of that Oxford word, combined with a random salt (to avoid the obvious URL dictionary attacks). In all seriousness, I do think it's a fine practice to have a unique URL for your admin. But the admin is password protected, so it's not really necessary to change your admin URL unless you or your clients are going to be practicing bad password habits. Still, every little bit of security is always good, especially ones that are so easy to add.2 points
-
Regular expressions are like a different language to me I'm much more comfortable with regular espresso's You threw this in to trip people up right? This sounds made up (but I'm certain it isn't ).2 points
-
2 points
-
GOT IT! Anyone notice I had a superfluous "home" in the first line??? Removed that and it works. So my final code is: <?php $footers = $pages->get("/blocks/footer-blocks/")->children("limit=3"); foreach($footers as $footerblocks) { ?> <div class="span3"> <?php echo $footerblocks->render(); ?> </div> <?php } ?> Thanks everyone!2 points
-
This question has actually come up many times. You guys will be glad to know I've just pushed some updates to the installer for 2.3 that tells you how to change the admin URL: https://github.com/ryancramerdesign/ProcessWire/blob/dev/install.php#L5272 points
-
Hi. As a fairly new person myself, I can vouch for how friendly and helpful the ProcessWire community is to newcomers.2 points
-
Thankee kindly, Moreweb One of those "pretty damned obvious things to find if you actually sat down and thought about it and were not so worried that the recent rain has flooded your veggie patch" sort of moments... Joss2 points
-
Greetings Marco, I'm still kind of new here myself. But I have come from a similar history as you -- worked with Joomla mostly. If you are like me, you will find that ProcessWire opens up that creativity that was always in you, but which was held back by limitations of other systems. Thanks, Matthew2 points
-
Hi MatthewSchenker, you can create a page (gallerytypes) and these page have some childs. In this case you gallery types. - gallerytypes - - Master Artist - - Emerging Artist - - Virtual Exhibition If you need this checkbox for the backend do the following: Create a new field, type must be "page". Save this. In the next step you can set the input for your field. (Input -> Selectable Pages) If you need these categories in your frontend use this code: <select> <?php $categories = $pages->get("/gallerytypes/")->children; foreach($categories as $category){ echo '<option value="'. $category->id .'">'. $category->title .'</option>'; } <select> y. ?>2 points
-
Perhaps slightly off-topic (or on-topic but from a programmer's twisted pov.) When dealing with object oriented PHP code, I like to keep things terse and also like to be able to chain things straight from when they are constructed (kind of like the fluent style) -- but PHP doesn't let you do it. So, when I want to to do this in various parts of my code... echo new somethingOrOther()->set('size', 'big')->render(); ...PHP only lets me do this... $thing = new somethingOrOther(); echo $thing->set('size', big')->render(); Yikes! However, if I define a function (once) called newSomethingOrOther() then I can get what I want easily... function newSomethingOrOther() { return new somethingOrOther(); } // The following now works as I want, however many times I need it in my code... echo newSomethingOrOther()->set('size', 'big')->render(); Ok, end of diversion, as you were.2 points
-
ProcessWire modules are by nature meant to save time. There are 3 modules that I think can be big time savers on almost every project: The MarkupPagerNav module included with ProcessWire is hard to imagine being without. Yet, I was doing pagination without this for a long time before making it, and... things get done a lot quicker now. The MarkupSimpleNavigation module can be a big time saver when it comes to many common navigation scenarios. The FormBuilder module is a big time saver when it comes to creating forms. It's turned the most annoying and consuming part of development (for me at least) into one of the quickest and easiest. When it comes to front-end development, I'll admit that I've always preferred starting from scratch. But lately I've been enjoying what some of the CSS frameworks like Skeleton, Foundation and HTML Kickstart bring to the plate (and Twitter Bootstrap I'm guessing, but have not used it). With the appropriate project, these are huge time savers. The project I'm working on now (for a boarding school) needed to be responsive and very unique in design, and I found Skeleton to be the perfect balance there. It provides just enough to make things responsive, and very little else. That left little room for the design to be influenced by the framework (which was desirable in this case). If I didn't need responsive on a particular project, and could let the design benefit from some framework influence, I'd go straight to HTML Kickstart as the biggest time saving framework. Lastly, I'd say that using the Basic Profile as a starting point has always been a big time saver for me. Almost every site I build needs the core framework of fields and templates included with the basic profile. While all the markup and CSS ultimately get replaced, it saves a lot of time having these things there ready to implement.2 points
-
Lets see if we can get a quick-start tutorial going here. We'll start with something really simple and then work up from there. Tell me when something makes sense and when it doesn't and we'll adjust as we go. My thought is that we'd make a tutorial that plays on the 'hello world' phrase and lists information about planets in the solar system, starting with Earth. To keep it simple, we'll assume that the basic site profile is installed, as that's what comes with ProcessWire (so there's no need to uninstall anything). But we won't start using any of it's files tat this stage. Instead, we'll start out by creating our own files. STEP 1 – Create a template file Create a new file called: /site/templates/planet.php, and copy+paste the following HTML into that file: <html> <head> <title>Earth</title> </head> <body> <h1>Earth</h1> <h2>Type: Happy planet, Age: Millions of years</h2> <p>Earth (or the Earth) is the third planet from the Sun, and the densest and fifth-largest of the eight planets in the Solar System. It is also the largest of the Solar System's four terrestrial planets. It is sometimes referred to as the World, the Blue Planet, or by its Latin name, Terra.</p> </body> </html> The above is just a plain HTML file with nothing specific to ProcessWire. We will use this as the starting point for our template, and we'll go back and modify it later. STEP 2 – Add a template to ProcessWire Login to ProcessWire admin and go to Setup > Templates. This page shows a list of templates currently in the system. Click the Add New Template button. On the next screen that appears, you'll see it found your "planet" template file. Check the box next to the planet template and click Add Template. You may ignore any other options that appear on this screen. STEP 3 – Creating a page using your template Your planet template is now in the system and ready to use, but it's not being used by any pages. So lets create a page that uses the planet template. In the ProcessWire admin, click Pages in the top navigation. This is a site map if your page structure. We want to create a new page under the homepage, so click the new link that appears to the right of the home page. The next screen has 3 inputs: title, name and template. Enter "Earth" for the title, and the name should populate automatically. For the template, select planet. Then click Save. Now you have created a new page using the template that you added. You are now in the page edit screen and you should see your title field populated with "Earth". Click the View link that appears on this page edit screen. You should see the output of the HTML from step 1. Click the back button in your browser to return to the edit screen. STEP 4 – Creating a new field Now you know how to create a template and a page using that template. You could create more pages using the same template if you wanted to. But that wouldn't be particularly useful – this template file is just a static HTML file. Lets make it dynamic by creating some fields and adding them to it. We are going to create 3 fields to represent the pieces of data that currently appear in our static template. These include the planet's type, age in years, and a brief summary. We will call these fields: planet_type, planet_age and planet_summary. In ProcessWire admin, click Setup > Fields. This screen shows a list of fields currently in the system, most of which are general purpose fields for the basic profile. For the purposes of this tutorial, we are going to ignore those and create our own. Click the Add New Field button. On the next screen, enter "planet_type" for the Name, select "text" as the Type, and enter "Planet Type" for the Label. Then click the Save Field button. Now that your field is saved, you are on the Field Edit screen. At this point, your field is created and ready to be added to your planet template. Optional: While editing your field, click the details tab where you'll see a select box for Text Formatters. Select "HTML Entity Encoder" – this ensures that characters like "<", ">" and "&" will be converted to HTML entities and not confused as HTML tags. While not required, it's a good practice for text fields like this. After you've done that, click the Save Field button. STEP 5 – Creating more new fields In step 4 we created the planet_type field. Now we want to create the planet_age and planet_summary fields. So in this step, you'll want to do the same thing for the remaining two fields: Create the planet_age field exactly like you created the planet_type field, but enter "Planet age in years" for the label. Create the planet_summary field exactly like you created the planet_type field, but chose "textarea" as the Type and enter "Planet summary" for the label. Note that a "textarea" field is just like a "text" field, except that it can contain multiple lines of text. STEP 6 – Adding new fields to your template Now that you've created 3 new fields, you need to add them to your planet template. In ProcessWire admin, click Setup > Templates > planet. You are now editing your planet template. In the Fields select box, choose planet_type, then planet_age, then planet_summary. You will see each added to the list. Cick the Save Template button. STEP 7 – Editing a page using your template Now that you have new fields added to your template, go back and edit the Earth page you created earlier and populate the new fields that are on it. In ProcessWire admin, click Pages at the top, then click the Earth page, and click the edit button that appears to the right of it. You are now editing the Earth page you created earlier. You should see the new fields you added, waiting for text. Enter "Terrestrial planet" for Planet Type Enter "4.54 billion" for Planet Age in Years Paste in the text below for Planet Summary and then click Save. STEP 8 – Outputting dynamic data in your template file While still in the page editor from step 7, click the "View" link to see your page. Note that it still says "Happy planet" for type (rather than "Terrestrial planet") and "Millions of years" rather than "4.54 billion years". That's because the page is still being rendered with just the static data in it. We need to update the template file so that it recognizes the fields we added and outputs the values of those fields. Edit /site/templates/planet.php and replace the static text in there with tags like this, replacing field_name with the name of the field: <?php echo $page->field_name; ?> If supported by your server, you may also use this shorter format which some people find easier to look at and faster to enter: <?=$page->field_name?> Here is the /site/templates/planet.php file updated to output the content of the page using tags like the above: <html> <head> <title><?php echo $page->title; ?></title> </head> <body> <h1><?php echo $page->title; ?></h1> <h2>Type: <?php echo $page->planet_type; ?>, Age: <?php echo $page->planet_age; ?> years</h2> <p><?php echo $page->planet_summary; ?></p> </body> </html> After making these changes, save your planet.php template file. Now view your Earth page again. You should see it properly outputting all of the content you entered on the page, including "Terrestrial planet" for Type and "4.54 billion years" for age. Any changes you make from this point forward should be reflected in the output. STEP 9 – Creating more pages, reusing your template For this last step, we'll create another page (for Jupiter) using the same template just to demonstrate how a template may be reused. In ProcessWire Admin, click Pages and then click the new link to the right of the home page. Enter "Jupiter" as the Title and select "planet" for the Template. Click Save. Now that you are editing the Jupiter page, enter "Gas giant" for Type, enter "4.5 billion" for Age in Years, and copy+paste the following for Planet Summary: Click the Publish button and then View the page. You should now see your planet template being used to output the information for Jupiter rather than Earth. CONCLUSION In the above, we covered the basics of how to develop in ProcessWire, including the following: Creating templates and their associated template files Creating basic text fields and adding them to templates Creating and editing pages that use your templates Outputting the values of fields in template files If all of this makes sense so far, I thought we'd follow up next with a tutorial to take this further: Adding and outputting photos for each planet Creating navigation that lists all the other planets that have pages in the system …and we'd keep building upon the tutorial from there. If you all think this tutorial is helpful, then perhaps this can be a draft for a real tutorial we'll put on the site, so all of your help is appreciated in making this as good as it can be.1 point
-
Hi The current address of administration is /processwire. Is there anyway to change this? It is only because clients tend to think of their site as something that has an admin or administration section and really dont care which software it is and just want something memorable. Not hugely important, I know, but just one of those fiddly bits round the edges that can make something client friendly! Joss1 point
-
I and a friend used to sit in the office looking at all the book titles trying to work out difficult to guess passwords that were easy to remember. I asked my mother if she had any suggestions. She worked on the Ultra Secret during WW2 (look it up) so I was interested in her take. She made one little suggestion, so I tried it on my friend who was a bit of a hacking genius. He tried for three days and failed miserably. He gave up and said "okay, what is the password?" "There isn't one," I said. "That was her suggestion." She did the same trick with coding. She was talking to some students about how they worked with the Tipex and Engima machines and about simple codes. "Try this one," she suggested. "I like cream cakes." They battled for days trying to break it, before she gave the solution, which was "I like cream cakes." The lesson: before you waste hours trying to break a code, make sure it is actually a code in the first place! Apparently, that was a serious lesson back in the war. You had to be certain something was a code before you wasted many, many valuable hours. Joss1 point
-
It's ver flexible doing it the Page way: I had a csv list of all cities in Holland. (3500) or something I created a "folder" cities and imported all cities with the import CSV module into this "folder". Now now i'm able to use the "Page Autocomplete" in the manager. love it, see ryans movie.1 point
-
There's also "possessive quantifiers" and "illogical shift upwards". Oops, scratch the last one, that's a machine code mnemonic a bit like "halt and catch fire".1 point
-
This is correct, the pattern is validated at server side too, so the HTML5 attribute is just a "nice to have". Though the fact that it's there provided good motivation for adding pattern support to the text field. Previously I thought regular expressions were too cryptic and code-oriented to expect from most users. But hey, if HTML5 is suggesting it and most browsers are implementing it, then we absolutely should. Personally I love regular expressions, but don't know many web developers that know how to use them. But it looks like that's changing, and sites like that html5pattern.com are great resources too.1 point
-
Hi @Martijn These HTML5 extended attributes should be totally transparent to browsers that don't support them so I don't think there would be any need for PW to have to treat them differently as you'd still have to do server side validation/checking on entered values anyway.1 point
-
You guys keep taking me to school. Thanks Ryan. And also thanks to Soma, Diogo and Antti. I haven't been following the repeater thread and should be I suppose. This solution works great. I feel a lot lighter now.1 point
-
@Matthew, partially on topic: have you had a look at textile for some of its typographic features (see the entities section) like automatic curly-quotes, em-dashes, elipses, dimensions etc? Ryan wrote a textformatter module for it that you can apply to your text fields.1 point
-
So much more fun would be "if left empty, we will pick a random incredibly long word from the full version of the Oxford English Dictionary, and email it to you next Christmas." There are some good reasons why some people think I should be kept as far from design as possible.... Joss1 point
-
It makes sense - makes people think about security. Make it required too. Add a note that you can also change this at a later stage if you want. Joss1 point
-
I'm actually thinking I might just making it an input in the installer. "What do you want your admin URL to be?" or something like that.1 point
-
Greetings Ryan, I've been playing with the 2.3 release from Github. It seems ready for prime time! Well, at least in my testing I haven't had any issues. Thanks for all your efforts! In just a short time, your CMS and the community around it has helped me make a giant leap in my site building. Matthew1 point
-
If you want to access another MySQL connection, you have any of the native PHP options (mysqli, PDO) available at your disposal. You could also use ProcessWire's Database class (derived from mysqli) to start another connection. Lastly, you could include some other library like to use ActiveRecord from Code Igniter, for example. Personally, I would just keep it simple and use Database, mysqli or PDO. But I would not use mysql_connect, because the old mysql driver in PHP is deprecated... you can use it, but your code might break in some future version of PHP. If you want to use PW's Database class, here's an example of how you'd do it: $mydb = new Database('localhost', 'user', 'pass', 'db_name'); $result = $mydb->query("SELECT * FROM some_table"); while($row = $result->fetch_assoc()) { print_r($row); } See PHP's mysqli functions, as the Database class essentially is identical to mysqli with some extra PW-specific stuff thrown in that won't matter if you are interacting with a non-PW database. To use native mysqli, you'd just replace "new Database(...)" with "new mysqli(...)".1 point
-
Andy Clarke release a complete redo of "320 and Up" which is mobile first based off HTML5Boilerplate. No docs but CSS.1 point
-
The clients don't even need to see those pages. If you check "Allow new pages to be created from field?" on the field options, they will be able to create new pages on the field itself.1 point
-
1 point
-
Further if you create those "category" pages, that will make the options, somewhere in your site structure you can even use those same pages to display galleries that belong to that particular category and you don't need to create such pages. Later you could add an image or description to those pages to display. So like this /galleries/categories/master-artist/ Would be also a viewable page and list all galleries that have that category selected. It goes hand in hand and requires only minimal code at the end. Need a new option? Create a new Page there and you're done. (wow so many replies already while writing this )1 point
-
I think this $highlights = $pages->find("template=template-news, sort=-newsDate, highlight=1, limit=5"); is what I need. Thanks to all!1 point
-
function instant($object) { return $object; } instant(new SomethingOrAnother)->size('big-like-hell')->render();1 point
-
On nearly any site I've built, the photos are accompanying some product. So a site like that one linked above will have a single images field that all the images for the property go into. And then there are a few thousand of those properties (each represented by a page). Most properties have 20-40 photos. So if we averaged 30 photos per property, and there were 3,000 properties, we'd have 90k photos. I don't know what the actual number is as I've not counted up the totals on those sites in awhile. But there's nothing complex going on there, just a few thousand pages that each have a single images field.1 point
-
This is an simple example module one can create within minutes to add a custom template variable "$channel" you can use in templates if you load the module (note it's not autoload). The important part here is the $this->fuel->set("channel",$this); in the init() function, which creates the template variable (like $pages) and attaches the class to it with $this. Just a simple $modules->get("ModuleName"); will do it in the start of you main template or, you could also make it autoload if you really want to load in on every request (front and backend) Create a module MyChannels.module with something like this, install it and you're set. You could create also one module for tags. class MyChannels extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'My Channels', 'version' => 100, 'summary' => 'Useful functions for templates.', 'href' => '', 'singular' => true ); } public function init() { $this->fuel->set("channel", $this); } public function countMedia() { $count = $this->pages->count("template=media-channel"); return $count; } } To load the module in a template $modules->get("MyChannels"); // load the module // now you can use echo $channel->countMedia(); Another method would be to have a helper module, that also isn't autoload, but you instance it on a variable and use it to call different module public methods. Same code but slightly different in that you only have one module with lots of functions and use it slightly different. class MyHelpers 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' => 'My Helpers', 'version' => 100, 'summary' => 'Useful functions for templates.', 'href' => '', 'singular' => true ); } public function init() { // maybe good to add hooks here if needed in the project } public function countMediaChannel($options = null) { $count = $this->pages->count("template=media-channel $options"); return $count; } public function countMediaTag() { $count = wire("pages")->count("template=media-tag"); return $count; } } To load this module in a template $mediahelper = $modules->get("MyChannels"); // load the module // now you can use it echo $mediahelper->countMediaChannel(",include=all"); I do this a lot, and sometimes only because it's fun and feels good, but also helps. Everybody can do it, even I. This is only some pseudo code, but there's nothing else involved. If you familar with PW API in templates you can code modules. Also take a look at the HelloWorld.module that comes with the basic-profile install. There's also more examples like properties1 point
-
Your theory is correct. When you search fields in a repeater, it is returning the pages that match, not the individual repeater items that match. So your search will be returning pages that have at least one of the repeater items matching your search. Once you've got one of those pages, you'd still need to determine which of the repeater items matched. What you may want to do is aim to match the individual repeater items instead. $matches = $pages->find("template=repeater_rental_period, date_from>=$fromvalue, date_to<=$tovalue, booked=1, include=all"); Then there's the question of how to determine which 'property' pages have the items you matched above. This is a relatively uncommon scenario, so I don't yet have a pretty solution for this. But you can determine the the property (as in real estate property) from each matching repeater item like this: foreach($matches as $item) { $property = $pages->get((int) substr($item->parent->name, 9)); if(!$property->viewable()) continue; // skip if property is unpublished or something // now you have the $property and the matching repeater $item } That solution comes via Soma, Diogo and Antti: I'll come up with something built-in for this soon, but until then the above is probably the best way to go.1 point
-
Just experimented also a little and made a little example based on Martjin's code. With some improvements and simpler add image routine. No need to create a new PageImage as the page already has PageImages field. Just add the path to the file and save page. This can also be a remote web url. Also this example shows how error handling can be done. I also used a "/.tmp_upload" folder to upload images first and only add to the page if everything is valid. Since $u->execute() uploads the file to the destination specified, it could be a security issue, if not dealed correctly with it. As far as security goes this folder should be made publicly not accessible via htaccess (in comment). In 2.3 you could maybe use built in restriction to files on pages, but not sure it would be appropriate here. Further, I delete the images uploaded in tmp folder in either case. This is all example code and may even need additional security for real public uploads. (mime types check of files by the WireUpload is sufficient? Ryan?) I've put the code on gist.github: https://gist.github.com/41509741 point
-
1 point
-
It would. Just not too simple. I find it amazing that there isn't a single open source editor that takes different approach - but there are many editors that are tied to single commercial app (like mad mimi etc). Something like mindplay was talking about here: http://processwire.com/talk/topic/2103-problem-with-tinymce-in-chrome/#entry19695 I'm all in to help contributing in a such module, if there will be a community effort. I believe it is much more JS than it is PW or PHP, so it would be wise to open source it as independent software. Then it would be tied deeply to PW to provide unique and top notch editor. It could also integrate some other editor for basic editing options (links, headings, tables, lists etc).1 point
-
Definitely, I think this would be a good thing to do. I'd like to see (and create) more profiles (whether free or commercial). This is one area where we don't have much to offer yet, but it's so easy to do, so I think I'm going to have to dedicate some time to this once 2.3 is out.1 point
-
I sometimes use CSV import module to create lots of pages from one list or names or titles. It's very handy and even can import images or files from an old website.1 point
-
WillyC's solution is a good way to go if you have this need. But want to mention that the whole idea of multiple routes to a page kind of goes against the grain of the ProcessWire philosophy. By design, there is only one URL to any given page. This is different from systems that disconnect their data from URLs (Drupal, EE, etc.). ProcessWire considers pages like files on a file system. We are trying to embrace the way that the web is addressed rather than counter it. I understand the desire to make a shorter URL for a given page, and that's a fine reason to implement a solution like this (and I've done it myself too). But the reason you don't see things like this outlined in the documentation is because I don't think it's a best practice, whether in ProcessWire or on the web in general. So if someone uses multiple routes, I would suggest it only to solve a specific need after a site is produced… not as something to build around from the start.1 point
-
i.am first you can puut this in your head.inc tamplate or some includeded file before.u are doing $page->url $pages->addHookAfter('Page::path', null, 'hookPagePath'); function hookPagePath(HookEvent $e) { $page = $e->object; if($page->template == 'article') $e->return = "/blog/$page->name/"; }1 point
-
I think it's quite telling that there isn't a tag for PW on Stack Overflow.1 point
-
Marc, when you are developing a site it's good to turn debug mode on. This will ensure that errors are sent to the screen, exceptions reported, etc. This can be found in /site/config.php. By default, it is false. You'll want to change it to true: $config->debug = true; Obviously you don't want this enabled for production sites, so remember to change it back to false for live/production sites. I don't see any problem with using var_dump, var_export, print_r, etc. so long as you are directing that output to where you can see it. Also avoid running these functions on PW objects as you may get into an infinite loop. Sometimes it can be difficult to track the output of these functions because PW performs a redirect after most POSTs. But if you use PW's built-in reporting functions, they will get queued between requests until they are output. Here are the relevant functions bellow. They will produce the messages that you see at the top of your screen in PW admin: $this->message("status message"); $this->message("status message that only appears in debug mode", Notice::debug); $this->error("error message"); $this->error("error message that only appears in debug mode", Notice::debug); If you are outside of a Wire derived object, you can call upon any API var to handle the notice for you. For example: wire('session')->message('status message'); wire('pages')->error('error message'); Note that these reporting functions above are for the admin (and related modules), and they don't do anything on the front-end of your site. How you choose to debug or report errors on the front-end is at your discretion. Personally, I keep debug mode on in development, and this puts PHP into E_ALL | E_STRICT error reporting mode... it reports everything possible. If I need to examine the value of something on the front-end, I'll do it the old fashioned way with just PHP. Though others may prefer to go further with their debugging tools. If you want to keep your own error log, here's how (anywhere in PW): $log = new FileLog($config->paths->logs . 'my-log.txt'); $log->save('whatever message you want'); You can direct it to store logs wherever you want, but I suggest using the PW logs dir as shown in the example above. This will make the log appear in /site/assets/logs/, and this directory is not web accessible for security.1 point
-
An idea for part two of the planets tutorial: Planet type could be a great place to introduce relational page fields. This might also help cement the idea of just what a page can be in ProcessWire.1 point
-
The default profile is meant as a clean starting point, though it's also not completely blank. For me, it is at least a much better starting point than nothing, but i know others may prefer something even less. In ProcessWire, you can't have a completely blank stating point because some built-in pages need templates and fields (like admin, home and 404). But here's how you can get to a more blank state: 1. Open the 'trash' page in the page list, then click 'move' to drag these 4 pages to the trash: /about/ /templates/ /sitemap/ /search/ Then empty the trash. This will leave you with just your homepage, 404 page, admin, and trash … all of which are required in any PW installation. 2. Now you want to go to Setup > Templates. Delete the 'sitemap' and 'search' templates, unless you want to keep either one of them. Edit the 'basic-page' and 'home' templates and remove all the fields except for 'title'. Save. 3. Go to Setup > Fields, and delete all the non-system fields except for 'title'. 4. Delete all the files in /site/templates/ except for admin.php and home.php. Following that, you are starting from the most blank state possible in ProcessWire. Now start creating your own templates and fields, and note that you'll very likely be re-creating the fields you just deleted --they are fields that tend to be needed on most sites. That's why I think it's a little better to start with the included profile and rename/replace things as you go--it saves time.1 point
-
He's not only quick to answer, he is also clear, didactic and informative. I don't have time to play with PW currently, but I'm always reading new posts just because the answers are always interesting.1 point