Leaderboard
Popular Content
Showing content with the highest reputation on 06/05/2014 in all areas
-
@horst Just pushed a new version of ProcessDiagnostics and DiagnoseDatabase that should now allow you to optimize any table that has overhead. The new code allows any Diagnose module to provide custom actions via a hook. Here's how I've done it for optimizing tables but there might be a better way. Please let me know if this works for you.6 points
-
1. Someone remind me that $pages->get("/home/") does NOT get the root home page!!!!!! (However correct it might look...) Try $pages->get("/") instead..... or an id or something sensible. Any others?6 points
-
5 points
-
Ah and just remembered that since PW 2.4 the simplest way to count values of certain keys/fields within a PageArray/WireArray is using the new WireAarray::explode() - combined with using PHP's array_count_values(array) you already used, it's down to this: $someFields = array("province", "network"); $somePages = $pages->find("template=child-template, category=xxx"); $resultArray = array(); foreach($someFields as $field) { $resultArray[$field] = array_count_values($somePages->explode($field)); } // that's it show array result foreach($resultArray as $field => $values) { foreach($values as $value => $count) { echo "<p>$field - $value: $count</p>"; } }4 points
-
$pages->find("title=yes"); Can return multiple pages with different templates. vehicles | +-- honda cr-v (template:cars, fields: • color:yellow/amount_wheels:4) | +-- honda gold wing (template:moters, fields: • color:yellow/amount_wheels:2) Here you can search all vehicles with the color yellow for example For every found page you know what vehicle it is from the template $pages->find(parent.name=vehicles, amount_wheels=2); will return 'honda gold wing' page with the motors template4 points
-
Hi Dylan! The point with a function is that it can be kept in a separate file that is included with your templates and then can be used anywhere. So, to take a very simple example: lets create a file for functions: myfunctions.php Then include it at the head of our template (either directly or via a separate header file as I used in the tutorial): <?php include("myfunctions.php"); ?> Generally speaking, since this function file could be used for anything, you probably want it as the very first thing right at the very top of your template structure - otherwise it won't be useful if it has functions to do with the <head> or something. Okay, that was the first easy bit. Now, create a function that gets posts, based on whatever page is their parent: function myPosts($postnumb) { $posts = wire("pages")->find("parent=/postparent/, limit=$postnumb); } Right, here we are using a variable called $postnumb which we will use later to set the limit of the number of posts we want. Then we are creating a variable called $posts which will contain the array of pages grabbed by the find action. Obviously, the postparent will be whatever page is the parent of all your posts! (That could be a hidden page, or a page without a template file or it could be a published and displayed page - it doesn't matter really. You could also select posts based on their template, if you wished, and then it wouldn't matter what the parent was.... anything is possible) Now, we need to loop through them: function myPosts($postnumb) { $posts = wire("pages")->find("parent=/postparent/, limit=$postnumb); $out =""; // This just sets up the variable we will use for our result foreach($posts as $post){ $out .="<h3>{$post->title}</h3>"; } //end foreach return $out; } // end function There we go; i have just looped through the title, for the sake of an example. Also, I am returning the value of $out at the end. Now to add this to a page: <?php echo myPosts(5); ?> So, I am echoing the function (or more to the point, the value of $out) and I am saying that I want to limit the number of posts to 5. When the function is called, the 5 in the brackets is passed to the function as the $postnumb variable and then is used as the limit in the find selector. You can now reuse this function all over your site and change the number of posts each time. Does that sort of guide you in the right direction while still leaving you a bit to work out? Joss4 points
-
Ok @n0sleeved, I think I got the solution Here in my office I got your same setup and, following the exact same procedure you mention, I recieve the error MySql gave you. To solve this I've choosen not to export through the "Rapid" option, and go for the "Custom" one. In the options panel I have then checked: Add instruction DROP TABLE / VIEW / PROCEDURE / FUNCTION / EVENT and exported leaving all the rest with default values. It worked! Let us know!4 points
-
hi jordanlev and welcome. processwire is so flexible that you could probably emulate all of your favorite features of Concrete5 very simply and quickly, using some custom modules... I started with Joomla way back in '06 and i probably still retain a couple of concepts that i liked about that system (they might have had 1-2 good ideas); for example i tend to favor building my own navigation system like Joomla does, since i always tend to need a ton of flexibility with menus and i can't deal with being tied to the page tree. likewise there are plenty of wireites who defected from modx but still retain some of the logic of how that system worked, and apply it to their PW workflow; Recently kongondo released a blog module that is sure to close the argument for any remote reason to mention wordprass*... I started helping a couple of clients build shopify sites, and after using that system, looking at their templating language and seeing the backend management, i was surprised because i thought it would be more advanced; a simple example is with PW's image handling, which in itself saves huge amounts of time; with most other systems you have to resize the images prior to loading them into the cms.. but of course the thought immediately occurred to me about how easy it would be to 'build' a clone of shopify with PW, maybe using the shop module and a custom admin theme... so i really appreciate you explaining the pros/cons of Concrete5, and what innovations, workflow benefits etc that it uses... and i think some people here on the forum will probably come up with suggestions for how to implement those things with PW; i think you'll discover that because the way PW is structured, you can typically accomplish the same thing in PW in about 1/10 to 1/20 the code. (I know this for a fact as i have converted a couple of really complex wordpress themes to PW and the code trash was quite significant).. *spelling attributed to willyC4 points
-
Has anyone used the Vimium extension for Chrome? Over the past few days, I've been working on some productivity hacks and part of that included relying less on the mouse for basic tasks. I've never been a true Linux user or one who uses Vim, but I gave this extension a shot after a few days, it's very liberating to be able to browse websites and control Chrome (especially manipulating tabs) entirely with the keyboard! I can see myself using vintage mode for Sublime in the near future. Maybe also the ability to navigate my file manager (xyplorer) with keyboard shortcuts (or just start using the command line a lot more often). Check it out: http://vimium.github.io/3 points
-
Use parents() or closest(). If those color pages have a own template use that in the selector for closest() or parents(). Or parents()->eq(n) where n is the level of color pages.3 points
-
this is great...! i was trying to write this module about 2 months ago and couldn't figure out how to do it.. edit: brilliant, works perfectly, and even works using ../ to get out of the templates folder... this is going to be extremely useful for html5 video, selecting files to be used instead of uploading to processwire page.... and in other situations where we want to store large media assets somewhere else in the filesystem.. many thanks for this.3 points
-
FieldtypeSelectFile & InputfieldSelectFile Inputfield Select File is an Inputfield & Fieldtype to select a single file or folder and stores the name and / or use the selected file as page template. The last option enables the editor to use multiple views for a page, depending on the selected template. Settings The folder containing the files and/or folders.A relative path relative to the /site/templates/ folder. Hide file extensions Hide files Hide folders Natural Sort (Select options)Sort files and folders in natural ordering (PHP >= 5.4.0) Change Page Template Just before the Page::loaded event the selected file is set as template file for the page. This setting can only be applied once per a page and folders are exluded from the select inputfield. Note that a page with no associated template file will render with the selected file. When to use ? Let editors select a file and base your own logic upon this. With the change page template setting you're able to use the selected file as template file. This could reduce the amount of normal templates needed and let editors choose how the page get rendered. There are plenty of use cases for this Inputfield. In the examples I call the field selected_file. // let the editor choose a CSS file $config->styles->append($config->urls->templates . "styles/" . $page->selected_file); /** * advanced usage example * * You need multiple ways to render your markup. Let the site editor choose which * file the page need to render. * */ $tpl = new TemplateFile($config->paths->templates . "includes/" . $page->selected_file); $tpl->set('current', $page); $markup = $tpl->render(); (It could be a real good companion with InputfieldSelector) Download at GitHub Modules directory2 points
-
Textarea Markup inputfield Loosely based on core module InputfieldMarkup, InputfieldTextareaMarkup works with textareas (FieldtypeTextarea) and outputs plain text, markup and optionally values from other fields in Page Edit (backend). That output can be configured via field settings (Input tab) and then modified on a per-page basis, though only by superusers. For an example this: Hello World, I'm a {{template}}, my ID is {{id}} and my name is {{name}}! Would result in a non-editable (except by superusers) "markup field" with content along these lines: Hello World, I'm a basic-page, my ID is 1001 and my name is About! Content pulled from other fields is sanitised using $sanitizer->text() with default options, so no markup should get through, max length for individual field value is 255 etc. The module is available from GitHub. For more details check out README and/or modules directory page.2 points
-
wow, you're good! I'd have to look a good number of times into these code examples you gave. At first I thought there was a native PW function, and was trying to use: $a->getValues() - which would return a php array with all values. $a->unique() - which would return array without duplicate values. But I really did not know how to use them inside the function, so I went for the long walk. lol Your examples are very good to study on (as I am still learning php) and I probably end up with a way of using them. My plan is not to just launch and then build further, but to build every week something, and much much later I launch. For now the learning curve is way to much fun, it's just the explaining from my part which is hard sometimes! I probably also did not mention my field values are in fact page selects. So to get all those values into an array, I would need to use a find parent=provincie and take child page names. I know PW is one of the fastest to retrieve items of any kind. Good job from Ryan! But I am concerned because I have 8 fields (parent page) with each about 30 child pages. Would it be an overload to use that in a function?2 points
-
A hardcoded parent folder id (1286) isn't the best way to specify it, ($page->parent->id != 1286 && $page->parent->id != 7) && $page->parentPrevious->id == 1286 ... here is the code if you use it with wiremail: public function sendMailOnChange($event) { $page = $event->arguments[0]; if(!$page->parentPrevious) return; // if page is not being moved then stop now // When page is moved outside its parent but not trash if(($page->parent->id != 1286 && $page->parent->id != 7) && $page->parentPrevious->id == 1286) { // Email address of user that created page $userEmail = $page->createdUser->email; // Message that appears after page is moved $this->message(sprintf( __("Mail was sent to: %s at his email address: %s "), $page->createdUser->name, $userEmail); // preparing and sending email $subject = __("YOUR MESSAGE IS MOVED"); $textBody = sprintf( __("Hello: %s \r\nyour post has been moved !!\r\nYou can find it here: %s"), $page->createdUser->name, $config->httpHost . $page->url); $from = 'me@example.com'; // if you have defined it in config page, you simply can send an empty string here $numSent = wireMail($userEmail, $from, $subject, $textBody); } } If you have installed one of the extended wireMail modules, you have done your smtp server config on the modules config page and don't need it to repeate in the code for every mail you send. Also you have tested via a testconnection if the settings a free of typos. One more thought: maybe a simple plaintext mail is enough, if the only html you need are 2 linebreaks. - plaintext does support that too.2 points
-
To get something as a function, just for learning purposes, the code could be like this function getDistinctValues(PageArray $pageArray, array $fields){ $arr = array(); foreach($pageArray as $p) foreach($fields as $field) if(isset($resultArray[$field][$p->$field])) $arr[$field][$p->$field]++; else $arr[$field][$p->$field] = 1; return $arr; } $someFields = array("title", "headline"); $somePages = $pages->find("template=basic-page"); $resultArray = getDistinctValues($somePages, $someFields); foreach($resultArray as $field => $values) foreach($values as $value => $count) echo "<p>$field - $value: $count</p>"; And following is a way to add a new method to a PageArray using a method hook. // this is right in a template code, but could also be in a autoload helper module wire()->addHook("PageArray::getDistinctValues", null, function(HookEvent $event){ $pageArray = $event->object; // the page array getDistinctValues($fieldsArr) is called on $fieldsArray = $event->arguments(0); // the first argument $arr = array(); foreach($pageArray as $p) foreach($fieldsArray as $field) if(isset($arr[$field][$p->$field])) $arr[$field][$p->$field]++; else $arr[$field][$p->$field] = 1; $event->return = $arr; }); $someFields = array("title", "headline"); // And now you can do this on a page find result $resultArray = $pages->find("template=child-template")->getDistinctValues($someFields); foreach($resultArray as $field => $values) foreach($values as $value => $count) echo "<p>$field - $value: $count</p>";2 points
-
This is my first module, so be easy on me! I am sure there was a faster and better way to do it, but this is what I have so far and it works pretty well! I figure by showing it, one of you may see a way to make it better! To use it, just make a hidden "csv" page in your root and add at least one csv item as a child. The children will need to have a "csv" template that has a csvFile field, and a csvDatabaseTable field. (I am thinking about adding a third one for csvDelimeter.) Also, I added a new admin page called "Read CSV files", and selected this module as the process. This reads all the children of that csv page, right now I just look up the csv page by id, so be sure and change that to hook it up to the correct page, and puts the content of the csv files into the database table listed on the child. (emptys the table first.) As of right now, the database table needs to be created in advance with the correct number of columns listed in the csv file. How much more work do you think I need to add in before it is worth listing as a public module? I just have never done one and was not sure! Thanks! Here is the page output: Importing All CSV files under csv page (id=1082) Searching for available files: Found: 1 Importing (csvFile.csv) into (csvDatabaseTable) imp row 2, imp row 3, imp row 4, imp row 5, imp row 6 Import Complete! Here is the code: <? class ReadCSV extends Process { public static function getModuleInfo() { return array( 'title' => 'Read CSV', 'summary' => 'This Module Reads the csv files under the csv page and inserts them into a database table. (Finds children of page id=1082)', 'version' => 001, ); } public function execute() { $ReturnHTML = '<p><b>Importing All CSV files under csv page (id=1082)</b></p>'; $ReturnHTML .= '<p>Searching for available files:</p>'; //find all csv files that are below the csv page. (Have it's id as their parent) $matches = $this->pages->find("parent=1082"); //Must spesify $this in a module. The following method also works: $matches = wire("pages")->find("parent=1082"); $count = count($matches); if($count) { $ReturnHTML .= "<p>Found: $count</p>"; foreach($matches as $m) { $csvDelimeter = ','; $csvEnclosure = '"'; $csvPath = '../..' . $this->config->urls->files . $m->id . '/'; //Format: ../site/assets/files/1083/ can also use $config->paths->files. (I added the ../.. to get out of the modules and sites folder.) $csvFullPath = $csvPath . $m->csvFile; $ReturnHTML .= "<p>Importing $m->csvFile into $m->csvDatabaseTable</p>"; //clear out the current database $sql = "TRUNCATE TABLE `$m->csvDatabaseTable`"; $database = $this->wire('database'); $database->exec($sql); //open csv ini_set("auto_detect_line_endings", true); //this is required. I think they are creating the csv on a mac or linux is the reason. $row = 0; $autoid = 1; if (($handle = fopen($csvFullPath, "r")) !== FALSE) { while (($data = fgetcsv($handle, 0, $csvDelimeter, $csvEnclosure)) !== FALSE) { $num = count($data); $row++; //$ReturnHTML .= "<p> $num fields in line $row: <br /></p>\n"; $allData = ''; //this holds the value string. (cell data.) for ($c=0; $c < $num; $c++) { $allData .= '"' . $data[$c] . '",'; } //insert the data if($row == 1){ //skip row 1. Instead of reading the column names, I am just inserting the data so order is important. //echo "<p>Skipping the first row.</p>"; } else { $allData = trim($allData, ','); //trim the trailing , off. $allData = $autoid . ',' . $allData; //add an extra column for the auto id column //insert into db $sql = "INSERT INTO $m->csvDatabaseTable VALUES ($allData)"; $database = $this->wire('database'); $database->exec($sql); $ReturnHTML .= 'imp row ' . $row . ', '; $autoid++; } } //end loop through spreadsheet rows fclose($handle); $ReturnHTML = rtrim($ReturnHTML, ', '); $ReturnHTML .= '<p>Import Complete!</p>'; } //close open csv } // end for loop through pages } else { $ReturnHTML .= "<b>Sorry, no results were found.</b>"; } return $ReturnHTML; } // end of execute function } //end of class ?>2 points
-
Hi guys, so I am a huge fan of composer. PW is missing one of the good parts of composer. So here is a new installer to install the modules of PW via composer. If you have created a module for PW, what you need to do is add a composer.json file in your github repo and add it to packagist. An example composer.json is { "name": "vendor/package-name", "type": "pw-module", "description": "Your module what it does", "keywords": [ "keywords", "comma", "seprated"], "homepage": "https://github.com/harikt/Assets", "license": "BSD-2-Clause", "authors": [ { "name": "Assets Contributors", "homepage": "https://github.com/harikt/Assets/contributors" } ], "require": { "php": ">=5.3.0", "hari/pw-module": "dev-master" } } Note the minimum requirement is PHP 5.3 for composer is 5.3 . An example of a module that works with this is https://github.com/harikt/Assets ( Move the index.php to any where ) You are welcome to read the post at http://harikt.com/blog/2013/11/08/assets-for-processwire/ Installing modules How do you install the PW modules and the 3rd party dependencies ? Assuming you are in the PW folder. First download composer from http://getcomposer.org/download/. Hope you have composer.phar now. php composer.phar require vendor/package-name Will install if the vendor/package-name is of type "pw-module" and you have added the "hari/pw-module" in require section. { "name": "vendor/package-name", // more stuffs "type": "pw-module", "require": { "php": ">=5.3.0", "hari/pw-module": "dev-master" } } to `site/modules/PackageName` . php composer.phar require hari/assets Try the above and see where it is installed. Please add a composer.json if you are a module maintainer, for there is more things we can do with composer .2 points
-
ProcessWire is highly structural. here's a Pagelist, with accessories accessories template:accessories | +- wheel ( template:part ) | +- chair ( template:part ) If the accessories templates only allows children with the template of part, you can show all parts by looping all children of accessories.2 points
-
Soma is right: I gave the guest role page edit access... thanks! (kids, don't try this at home!)2 points
-
HELLO! My new portfolio website is nearly finished and I would love some feedback and bugs if anyone has a moment. Built with PW using mixup.js, ajax, loaded.js, tons of css transitions and some custom slideshow and canvas bits. currently here http://benbyford.com/dev/new/ but will be moving it soon to replace http://benbyford.com Thank you!2 points
-
I had one of these about a week ago as I was working on the ProcessDiagnostics module. I managed to inadvertently delete just the first line ("<?php") of index.php from the root directory and save the file. Apache started serving the index.php file as plain text - made me think that I'd messed up my apache config or .htaccess but it turned out to be my fat fingered deletion of a line on a file I shouldn't even have been editing. Dumb.2 points
-
Here is the code for module that sends email to page creator, once the page is moved from one parent to another. <?php require_once("/site/templates/phpmailer/class.phpmailer.php"); class sendMail extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Notify module', 'version' => 101, 'summary' => 'Send email after pages is moved to another parent', 'singular' => true, 'autoload' => true ); } public function init() { $this->pages->addHookAfter('Pages::saveReady', $this, 'sendMailOnChange'); } public function sendMailOnChange($event) { $page = $event->arguments[0]; if(!$page->parentPrevious) return; // if page is not being moved then stop now // When page is moved outside its parent but not trash if(($page->parent->id != 1286 && $page->parent->id != 7) && $page->parentPrevious->id == 1286) { //Email address of user that created page $userEmail = $page->createdUser->email; //Message that appears after page is moved $this->message("Mail was sent to :{$page->createdUser->name} at his email address: {$userEmail}"); $mail = new PHPMailer(); $mail->IsHTML(true); $mail->isSMTP(); $mail->Debugoutput = 'html'; $mail->Host = "YOUR HOST"; $mail->Port = 25; $mail->SMTPAuth = true; $mail->CharSet = "UTF-8"; $mail->Username = "EMAIL ADDRESS OF MAILBOX U WANT TO SEND MESSAGE FROM"; $mail->SetFrom("I USE SAME AS ABOVE $mail->Username"); $mail->Password = "PWD TO YOUR MAILBOX"; $mail->FromName = "STRING FROM"; $mail->AddAddress($userEmail); $mail->Subject = __("YOUR MESSAGE IS MOVED"); $mail->Body = "Hello: {$page->createdUser->name} <br />". __("your post has been moved !!"). "<br />". "You can find it here: <a href='{$config->httpHost}{$page->url}'>{$config->httpHost}{$page->url}</a>"; ; $mail->send(); } } } ?> I used phpmailer since im using it from the begining of project. If u can please show how would same function look with wireMail(); Cheers !2 points
-
Didn't think you would run with this code, but with the additions by kongondo(/horst) and if it's suits your needs, it's fine to use this. With regards to crawling: using the method above would do nothing special to hide the content, but if Google were to reach the page they would only be able to see the login page. If you want to also avoid that adding <meta name="robots" content="noindex, nofollow"> to the head of your html usually helps. Come to think of it, if pages can go from private to public and vice versa, by setting/unsetting the password field in the backend you probably want to add some extra logic to your template(s) that support the page_password field.2 points
-
In it's simplest form it could be something like this, where $page->page_password is a textfield you can set for every page that needs the login. <?php if ($_POST['awesome_password'] != $page->page_password) { echo <<<EOT <h1>Login</h1> <form name='form' method='post' action='$page->url'> <input type='password' title='Enter your password' name='awesome_password' /> <br /> <input type='submit' name='Submit' value='Login' /> </form> EOT; } else { echo "<p>This is the protected page. Content goes here.</p>"; } ?>2 points
-
The Module Blog for ProcessWire replicates and extends the popular Blog Profile. Blog is now in version 2. Please read the README in the Github link below in its entirety before using this module As of 20 December 2017 ProcessWire versions earlier than 3.x are not supported Blog Documentation is here (Work in Progress!) See this post for new features in version 2 or the readme in GitHub. To upgrade from version 1, see these instructions. ################################################## Most of the text below refers to Blog version 1 (left here for posterity). Blog version 1 consists of two modules: ProcessBlog: Manage Blog in the backend/Admin. MarkupBlog: Display Blog in the frontend. Being a module, Blog can be installed in both fresh and existing sites. Note, however, that presently, ProcessBlog is not compatible with existing installs of the Blog Profile. This is because of various structural and naming differences in respect of Fields, Templates, Template Files and Pages. If there is demand for such compatibility, I will code a separate version for managing Blog Profile installs. In order to use the 'Recent Tweets Widget', you will need to separately install and setup the module 'MarkupTwitterFeed'. Please read the README in the Github link below in its entirety before using this module (especially the bit about the Pages, etc. created by the module). I'll appreciate Beta testers, thanks! Stable release works fine. Download Modules Directory: http://modules.processwire.com/modules/process-blog/ Github: https://github.com/kongondo/Blog You can also install from right within your ProcessWire install. Screenshots (Blog version 1) Video Demos ProcessBlog MarkupBlog Credits Ryan Cramer The Alpha Testers and 'Critics' License GPL21 point
-
In case anyone is interested in using IRC to chat about ProcessWire, and having consulted with Ryan about it, I have registered #processwire on irc.freenode.net for that purpose. If you are a regular on freenode, just pop into #processwire. If you are not then the fastest way to get online is probably via the webchat interface at http://webchat.freenode.net/?channels=processwire&uio=d4 Hope to meet a few of you in there sometime.1 point
-
I am continuously bombarded with Wordpress this and Wordpress that, from all directions on how it is the best cms and the go to cms out there. It is starting to get a little silly. I can hardly read an article or visit a page without the mention of the holiness of Wordpress. It seems to have become some sort of mantra. Of course i don't agree. But it got me thinking. Are they all wrong? Are there any circumstances or reasons that anyone would use Wordpress over Processwire for a particular project?1 point
-
Being one of those rebellious few many that ignores the "cookie law", this amused me: As did their site here: http://nocookielaw.com/1 point
-
Kongondo. I am in awe! WOW, WOW, WOW!!! My mouth has dropped to the floor and my prayers have been answered! This has been designed so beautifully, logically, and intuitively :'(You are super talented my friend. This is something that has been needed for quite some time. Thank you so much for this!!! I'm speechless.1 point
-
@horst, It (phpmyadmin) does display overhead but I wouldn't bother installing it if you don't have it. The message you got from the tool is the correct one for InnoDB tables so that's OK.1 point
-
From my understanding, as the script is always running, the initial request will get the page and it will be cached internally. Subsequent requests would then use the local cached copy instead of hitting the database. It looks like Page has an uncache() method which accepts a single parameter page ID. So you could replace your call with: wire('pages')->uncache($pageId);1 point
-
The whole thing does make me scratch my head I must admit, because the ICO suggest in their 30-page document that you should, as a bare minimum, make a page listing cookies used on the site and make the link stand out more from other links - maybe at the top of the page. Scroll down to the footer to see theirs: http://ico.org.uk/1 point
-
1 point
-
Many moons ago (pre-Chrome) I used Firefox as my main browser. I enabled functionality (in about:config I think) which allowed the focusing of links using the keyboard. So you would press a key, start typing the text of a link on the page, and it would focus it so you could activate it by pressing Enter (Sort of like Ctrl+F but for links only). That was brilliant and I used it a lot, and I have never been able to find something like that for Chrome. This looks like a perfect replacement for that though, so thanks very much for finding and sharing1 point
-
1 point
-
1 point
-
Hello Pals(Developers/Webdesigners/Programmers) i am glad to announce to you that the site is now functional and everything is cool though i am still working on some things to add up. Am very grateful for your support. The site url is www.mcalleluya.mil.nf1 point
-
Even after reading your posts multiple times I don't understand a single thing. I doubt you'll find someone understanding what you want to do. Too abstract and not a comprehent case. After all it may help to understand if you actually tell the guys here what you need to achieve, rather than I need count field01 => valueX. It could be that you go completely wrong about doing something.1 point
-
Greetings, Well, earlier this week I was getting very little sleep and working on three projects simultaneously. I was making some changes to the CSS file for project 1, and kept reloading the page, wondering why that particular CSS change wasn't taking effect. I even opened Firebug and could not see the change. You can guess the reason. Sorry Joss, it's not as bad as yours. But there is a connection here: I was thinking of a certain pirate narrator while working. How do pirates get WiFi while out at sea? Thanks, Matthew1 point
-
$pass = $input->post->awesome_password; if( (isset($pass) && $pass != $page->page_password) || !$pass) //....show form etc... or better / shorter $pass = $input->post->awesome_password; if ( !$pass || $pass != $page->page_password ) //....show form etc...1 point
-
$user->isLoggedin() shouldn't be necessary here as $page->editable() already checks for various permission etc. So maybe do you have the guest role given page edit access? What happens if you click the link? Well I'm waiting for a facepalm here cause it's not possible.1 point
-
1 point
-
Update: Blog version 1.2 Read below before updating. For new installs, proceed as normal ------------------------------------- Changelog TL:DR: Comments visibility settings + Posts' Bulk Actions + Update Script Comments Comments visibility can be controlled 'globally' as well as on a 'per post' basis Default is that comments and comment form are visible. You do not need to specify this setting; it just applies A post's comments SPECIFIED visibility overrides the global setting except for one case (see below). Post Comments Settings are set via a page select on a Post's page (also in 'Settings' tab in Blog Dashboard - see below) No selection: Default [comments and comments form will be shown] Always Show Comments: This will enforce overriding of global setting (e.g. Disable Comments) Disable New Comments: Will show old comments but not the comments form; visitors will not be able to submit new comments & message 'Comments closed for this post' will be shown. Disable Comments: Will neither show old comments nor the comments form; visitors will not be able to submit new comments & will see message 'Comments not allowed for this post'. Old comments WILL NOT be deleted . Global Comments Settings are set via a page select on the Comments page (in Dashboard as well). Settings here DO NOT override a Post's Comments settings WHERE A SELECTION has been made (i.e. if NOT empty). No selection: Default [comments and comments form will be shown] Disable New Comments: Similar to above Post setting except will affect all Posts' comments where no comments visibility selection has been made. Disable Comments: Similar to above Post setting except will affect all Posts' comments where no comments visibility selection has been made. Global Maximum comments allowed per post. If any number > 0 is specified in this new setting, IRRESPECTIVE of a Post's comments settings, if a post's comments is greater than the maximum set here, then 'Disable New Comments' will kick in. So, this takes precedence. Note: If you are logged in as superuser, even PENDING and SPAM comments are counted; so, the Global Maximum may be 'temporarily reached', if that makes sense Recap of comments visibility, in order of descending priority: 1. Global Maximum comments allowed for posts (/blog/comments/) 2. Any comment visibility SPECIFIED on a post (i.e. not empty) (/blog/posts/your-post/) 3. Any Global comment visibility SPECIFIED on comments page (/blog/comments/) 4. Default. 'Settings' Tab You can also set both the Global comments visibility and the Global Maximum comments allowed per post on this tab. The current setting will always be selected in the input field. Note: A blank Global comments visibility means no setting specified . So, if you want to change to 'no global setting specified', just select a blank and save [equivalent to deselecting a page select] (hope this makes sense). Note: Where no Global Maximum comments is set (i.e. blank), saving in the 'Settings' Tab's General Settings will subsequently show a '0' [zero]. This is equivalent to a blank, so not to worry Bulk Actions Introducing Bulk Actions for the Posts Tab! Make bulk changes to posts: Unpublish/Publish Comments visibility (as specified above for Posts' Comments visibility). In this case, also a 'Default Comments View' selection available. This is the equivalent of the 'no selection' specified in page selection field above. Trash Delete (note: no warning given before delete; careful with this one!) New column in Posts' Table also shows currently specified Comments visibility for each post. 'Default' means no selection made. Other - Some code clean-up. - See blog-side-bar.inc issue below. UPDATING I have written an update script (attached) that will add the new features in Blog 1.2 (2 fields, 1 template, 3 pages, 2 page updates, etc.). I have thoroughly tested the script. However, try this first on a test/non-essential install! If everything works, you can use it on your live environment Note: This assumes you haven't changed the native Blog paths and page names. Otherwise, it won't work properly. It won't corrupt any data but may just not install some stuff Note: You will still need to update the module as normal in your PW admin! Above is just to save you manually creating the extra fields, etc. To update: # Copy and paste the contents of blog-upgrade-version1-2.txt at the very top of one of your template files. Save the template file. # The script will only run if you are logged in as a superuser so other users won't know what's happening. # View a page using the template file you've just amended. The new fields, template and pages will be created. # Reverse the changes to your template file and save. # Update Blog via PW Admin as usual (to version 1.2) # Copy blog.css to /site/templates/css/. blog-upgrade-version1-2.txt If you are using the blog-side-bar.inc you might want to make/note the following changes. This only affects existing Blog installs! (not new ones) There was a missing <br> tag + $item->date instead of $item->blog_date. This will ensure Recent Comments widget also show the Post's date. If you are using the code from this file, you can make the following changes: OLD: $date = $blogOut->formatDate($item->date); $out .= "<li><span class='date'>$date</span> <a href='{$item->url}'>{$item->title}</a></li>"; NEW: $date = $blogOut->formatDate($item->blog_date); $out .= "<li><span class='date'>" . $date. "</span><br> <a href='{$item->url}'>{$item->title}</a></li>"; In addition, the code has now been changed not to show 'recent posts widget' on the blog home page. @Adrian idea, thanks! Screens Happy blogging!1 point
-
Look up "Php heredoc" on Google and you will find everything you need on the subject The first result in the list at Php.net explains it pretty well.1 point
-
I'm finally continuing this module - thanks to Ole who's sponsoring it. Please post all open bugs here or directly at GitHub so I get an overview on what to do (you don't need to repost them if they are already posted here of course). Thanks, nico1 point
-
I think I understand what you want. Something like this very pseudo-code should point you in the right direction... <?php if($input->post->passkey == $page->passkey){ // Show for-your-eyes-only content // and perhaps set a cookie to allow viewing of content unhindered in future } else { // Show form asking for passkey (using method=post to avoid inadvertent sharing of passkey in url (with Miss Mountshaft?) if we used get) action=<?php echo $page->url; ?> }; ?> You will obviously need to wrap some proper php and html around this and perhaps separate bits out in the cause of DRYness.1 point
-
A very wonderful and remarkable piece of work. Thank you for producing this module. I believe and certainly hope that this module will further open the door for acceptance of ProcessWire in a lot of places. Kongondo, you have talent.1 point
-
Hi, I have send a PR to https://github.com/ryancramerdesign/ProcessExportProfile/pull/3 . If you have a private repo or you find a repo which has no composer.json , you can send a PR. And for the current time you can do like below { "minimum-stability": "dev", "repositories": [ { "type": "package", "package": { "name": "ryancramerdesign/process-export-profile", "version": "1.0.0", "source": { "url": "https://github.com/ryancramerdesign/ProcessExportProfile", "type": "git", "reference": "master" }, "type": "pw-module", "require": { "hari/pw-module": "dev-master" } } } ], "require": { "ryancramerdesign/process-export-profile": "1.0.0" } } and now you need composer.phar . Hope you have downloaded composer else please get from http://getcomposer.org/download/ and run php composer.phar update It will install the ProcessExportProfile module in site/modules/ProcessExportProfile . When you created a patch for the module, you can change the settings in composer.json , so you get that patch also until Ryan merged it or can switch between branches. See http://getcomposer.org/doc/05-repositories.md#loading-a-package-from-a-vcs-repository Thank you.1 point
-
That's fun: foreach($templates as $template){ foreach($template->fieldgroup as $field){ if($field->name == "myfield"){ $template->fieldgroup->remove($field); $template->fieldgroup->save(); echo "deleted $field->name"; } } }1 point