Leaderboard
Popular Content
Showing content with the highest reputation on 08/10/2012 in all areas
-
Guys, I've just commited a very first version of the module which compiles less to css. It almost haven't been tested so there's quite a possibility of bugs appearing. And don't expect much, it's very basic Edit: Forgot to mention. it's a wrapper which uses lessphp library, not my creation . A css-file is generated when you access frontend page and only if this css-file doesn't exist or it's older then less-file associated with it. The module also creates cache files in your css folder, but I hope I'll get rid of them in future versions. You can create full and minified versions of your css (it takes 2x more time to create both for now as it's not optimized). I hope it will be helpful (after a lot of improvements) to those who want to have less working "out of the box". Download it on GitHub. Will be happy to get your feedback. Won't be able to be here during the day though. Cheers.4 points
-
2 points
-
This is just my personal opinion: Until the fucking Joomla is on top with 10k upvotes, which is 10 times more votes than any other CMS has, the opensourcecms.org is useless POS. I once believed that site too, and used to look for CMS there. Not anymore.2 points
-
<?= and <? will be always enabled from PHP 5.4+ so if you don't need to support some rare shared hosts where shorthands are disabled then those are perfectly safe to use.2 points
-
Teppo is way too slow, always second FORUM PROTIP that I spied from Soma: quickly post something, then edit it few times. You'll win every time!2 points
-
Hi! Just finished my first module This module adds a new "Google-Analytics" Page in your Admin-Panel and displays various Statistics from a Google Analytics Account. It uses the JQuery plugin "jqplot" to display the charts. Github: https://github.com/w...GoogleAnalytics Modules directory: http://modules.proce...ogle-analytics/ Features Visits by Date (Chart) General Statistics about Visits (Total visits, Visit duration, New visitors, Returning visitors etc.) Demographics: Countries, Cities, Languages System: Browsers, Operating Systems, Screen Resolutions Mobile: Operating Systems, Screen Resolutions Pageviews by Date (Chart) Top Content Traffic Sources: Keywords, Referral Traffic by Domain and URI Choose a default date range displaying statistics: last 24 hours, 2 days, 1 week, 1 month etc. Custom date range by setting a "start date" and "end date" Requirements Google Account and Analytics Account A Project in the Google APIs Console cURL Installation 1) Create a Project in the Google APIs Console: Create a new Project in the APIs Console: code.google.com/apis/console/ Under Services, enable the Analytics API Under API Access: create an Oauth 2.0 Client-ID Give a Product Name, choose "Web-Application", Domain doesn't matter Enter a Redirect URI to the GA-Page in your Processwire Installation: http://yourdomain.com/processwire/google-analytics/ Notes: The redirect URI must exactly match with the URL from the new "Google Analytics" page in Processwire. Open the Page and copy the URL from the address-bar (localhost does work too!) The project created in the APIs Console can be reused for every Processwire installation using this module. You just have to enter more redirect URIs 2) Install the module: Place the module's files in /site/modules/ProcessGoogleAnalytics Install the Module via the Admin-Panel Enter Client-ID and Client-Secret keys from the created project in the module config Load the newly created page "Google-Analytics" and click on the button "authenticate" Grant the module access to the Analytics Data Choose a Google Analytics account (Domain) from the dropdown Done: You should see the statistics. Check out the module config options for further customization In order to let other users see the Google Analytics page, you must give their role access to the "ga-view" permission. Ps. Processwire is awesome and so is this community!1 point
-
Hi there, I'm trying to do the following: $array = new WireArray(); $array->set('test',123); but I always get an error: Error Exception: Item 'test' set to WireArray is not an allowed type What am I doing wrong? Thanks a lot!1 point
-
Fun fact: one of my first projects ever was a web site which ran multiple nested Joomla installations. The guy who built it obviously had never heard of something like sections before, so he just use one Joomla installation for every friggin' section of the site. (I flat out refused to work with the current "system", so it was rebuilt using a different CMS. Now it's waiting to be moved to PW.)1 point
-
I always considered Joomla an UMS... Universe Management System. Nothing less can be that complicated. End of Off-topic.1 point
-
Shall we just agree that the first rule of ProcessWire is: you do talk about ProcessWire? Because I think that will bring much more attention to the system in the long run than a high ranking on a web site which actually considers Joomla to be CMS …1 point
-
1 point
-
As for actually checking against and creating an account, you could adapt something like this (note this won't work out of the box, it's just copied and pasted from something on one of my sites): public function checkUser($forumUser) { // forumUser should be an array of: array('uid' => [integer], 'name' => [string]) $u = wire('pages')->get("template=user, user_member_id={$forumUser['uid']}, include=all"); if (!$u->name) { $u = new User(); $u->name = $forumUser['name']; $u->user_name = $forumUser['name']; $u->user_member_id = $forumUser['uid']; $u->addRole("guest"); $u->save(); } return $u; } You could adapt the above to check for a user with a certain name and whatever unique identifier the social networking login methods give you. I'd personally store that identifier in a field in the users template along with a field to store which social network it was - that way you don't run into issues with people from multiple networks having the same username and not being logged in. As usual, there's lots to consider but hopefully that's a start.1 point
-
If you do actually have a directory called /ProcessWire/ and you are accessing the URL /processwire/ then it doesn't matter if your OS is case sensitive as it's Apache that's connecting URLs to directories, not the OS. I'm running on MAMP in OS X and it is not case sensitive with the URL paths, meaning /ProcessWire/ is no different than /processwire/.1 point
-
That's correct. Just to reiterate what WIllyC was trying to communicate -- WireArray is an Array meant to store Wire objects. If you need to store something else, then regular PHP array is your best bet.1 point
-
hello forum, i've read somewhere in the docs that the use of template tags was given up with the switch from version 1 to 2. does that mean this code <li><a$class href='{$child->url}'>{$child->title}</a></li> as found in the head.inc with the official download is no longer valid? Or is the use of curly brackets a regular use of PHP (I'm very new to PHP unfortunately)? Wouldn't you rather write <?php echo $child->url ?> instead of {$child->url} ?? thanks, christoph1 point
-
Everything you find from processwire.com is valid. Version 1 was closed source system and Ryan only references it on his "background articles". Curly brackets work only inside php tags already. Your first example should be: <?php echo "<li><a$class href='{$child->url}'>{$child->title}</a></li>"; ?> If you are writing pure html then simplest way to output variables is: <li><a <?= $class ?>href='<?= $child->url ?>'><?= $child->title ?></a></li> Curly brackets are necessary when going deeper than one level on your objects, like this: <li><a <?= $class ?>href='<?= {$child->related_page->url} ?>'><?= {$child->related_page->title} ?></a></li> Hope this helps. PW uses pure PHP as a templating language.1 point
-
1 point
-
u can makke post-comment.php tamplate and than tell renderForm to have.action there (see options] with page id as get var or urlsegment. That tamplate load page id from that get var or urlsegment. that tamplate can call renderForm from page u loaded to process it. nice too.bcoz all yur other pages can use.cache if u like too1 point
-
Basically you can put the PW anywhere. But if you want "clean" domain (no subdirectories) then just make sure you point your docroot where your index.php is (and wire and site directories). You can even "nest" pw installations. You can run one site at www.cooldomain.com and yet another at www.cooldomain.com/subsite/. It just doesn't care. Coolest part of that: http://processwire.com/api/include/ I would but it this way: /var/www/htdocs/coolsite.com/ /var/www/htdocs/anothersite.com/ etc.. (also you might want to make the path simpler, like /www/coolsite.com/ etc..) This way it is clean and simple, and allows multiple domains/sites from your server.1 point
-
Thanks a lot Ryan. I just wanted to make sure that the folder name doesn't appear in the final URL. BTW, I'm having a total blast with PW! Lovin' it1 point
-
PW doesn't care where you run it or whether you move it between subdirectories, etc. So you should be fine. The only thing you need to consider is local links you may have in a TinyMCE field. Since that is raw HTML that TinyMCE uses, it may have direct links in it (if you've inserted images or links through TinyMCE). In that case, you'd want to do an search/replace on your DB dump file replacing "/ProcessWire/" with "/", before importing to your live site. There is also a module that can manage this for you called PageLinkAbstractor (currently being re-worked under the name LinkManager). But this module is one you have to start with and stick with, so probably not as helpful here. But I usually just do the search/replace when migrating from a local subdirectory site to a live root level site. Again, only necessary if you've got image, file or URL links in your TinyMCE rich text fields and are switching from subdir to root.1 point
-
Hello again. I kinda got this working with a few different effects. I had to implement a weird fix so the functions don't get called twice (notice the counter used to check if even or uneven) I just can't figure out why that is. If somebody could help that would be great! home.php <?php /** * Home template * */ include("./head.inc"); foreach($homepage->images as $img) { echo("Original</br>"); $image =$img->size(400, 400); echo "<img id='photo' src='{$image->url}' alt='{$image->description}' width='{$image->width}' height='{$image->height}' /><br/>"; echo("Gotham</br>"); $image =$img->size(400, 400)->fx(FieldtypeImageEffects::GOTHAM, 5, 1); echo "<img id='photo' src='{$image->url}' alt='{$image->description}' width='{$image->width}' height='{$image->height}' /><br/>"; echo("Toaster</br>"); $image = $img->size(400, 400)->fx(FieldtypeImageEffects::TOASTER, 1.2); echo "<img id='photo' src='{$image->url}' alt='{$image->description}' width='{$image->width}' height='{$image->height}' /><br/>"; echo("Nashville</br>"); $image = $img->size(400, 400)->fx(FieldtypeImageEffects::NASHVILLE, 1.2); echo "<img id='photo' src='{$image->url}' alt='{$image->description}' width='{$image->width}' height='{$image->height}' /><br/>"; echo("Custom frame</br>"); $image = $img->size(400, 400)->fx(FieldtypeImageEffects::NASHVILLE, 1.2)->fx(FieldtypeImageEffects::FRAME, "polaroid01.png"); echo "<img id='photo' src='{$image->url}' alt='{$image->description}' width='{$image->width}' height='{$image->height}' /><br/>"; break; } include("./foot.inc"); FieldtypeImageEffects.module <?php class FieldtypeImageEffects extends FieldtypeImage implements Module { const GOTHAM = "fxGotham"; const TOASTER = "fxToaster"; const NASHVILLE = "fxNashville"; const FRAME = "fxFrame"; private $counter = 0; public static function getModuleInfo() { return array ( 'title' => 'Image Effects', 'version' => 001, 'summary' => 'Add effects to images', 'href' => 'http://www.persommer.com', ); } public function init() { $this->addHook('Pageimage::fx', $this, 'fx'); } public function fx(HookEvent $event) { $this->counter++; if ($this->counter % 2) { switch ($event->arguments[0]) { case $this::GOTHAM: $event->return = $this->fxGotham($event); break; case $this::TOASTER: $event->return = $this->fxToaster($event); break; case $this::NASHVILLE: $event->return = $this->fxNashville($event); break; case $this::FRAME: $event->return = $this->fxFrame($event); break; default: $event->return = $event->object; } } else { //echo $this->counter . " is even<br>"; } } private function fxGotham(HookEvent $event) { isset($event->arguments[1]) ? $intColorize = $event->arguments[1] : $intColorize = 20; isset($event->arguments[2]) ? $floatGamma = $event->arguments[2] : $floatGamma = 0.5; $prefix = $this->sanitizeFilename("_" . $event->arguments[0] . $intColorize . $floatGamma); $img = $event->object; $imgBaseNameNew = $this->appendToFileName($img->basename, $prefix); $imgPath = $img->pagefiles->path . $img->basename; $imgPathNew = $img->pagefiles->path . $imgBaseNameNew; $this->execute("convert '$imgPath' -modulate 120,10,100 -fill '#222b6d' -colorize $intColorize -gamma $floatGamma -contrast -contrast '$imgPathNew'"); //!is_file($imgPathNew) ? $this->execute($strExe) : false; $event->object->setFilename($imgBaseNameNew); return $event->object; // $pageimage = clone $event->object; // $pageimage->setFilename($imgBaseNameNew); // $pageimage->setOriginal($event->object); // return $pageimage; } private function fxToaster(HookEvent $event) { isset($event->arguments[1]) ? $floatGamma = $event->arguments[1] : $floatGamma = 1.2; $width = $event->object->width(); $height = $event->object->height(); $prefix = $this->sanitizeFilename("_" . $event->arguments[0] . $floatGamma); $img = $event->object; $imgBaseNameNew = $this->appendToFileName($img->basename, $prefix); $imgPath = $img->pagefiles->path . $img->basename; $imgPathNew = $img->pagefiles->path . $imgBaseNameNew; $this->colortone($imgPath, $imgPathNew, '#330000', 100, 0); $this->execute("convert '$imgPathNew' -modulate 150,80,100 -gamma $floatGamma -contrast -contrast '$imgPathNew'"); $this->vignette($imgPathNew, $imgPathNew, $width, $height, 'none', 'LavenderBlush3'); $this->vignette($imgPathNew, $imgPathNew, $width, $height, '#ff9966', 'none'); //!is_file($imgPathNew) ? $this->execute($strExe) : false; $event->object->setFilename($imgBaseNameNew); return $event->object; } private function fxNashville(HookEvent $event) { isset($event->arguments[1]) ? $floatGamma = $event->arguments[1] : $floatGamma = 1.2; $width = $event->object->width(); $height = $event->object->height(); $prefix = $this->sanitizeFilename("_" . $event->arguments[0] . $floatGamma); $img = $event->object; $imgBaseNameNew = $this->appendToFileName($img->basename, $prefix); $imgPath = $img->pagefiles->path . $img->basename; $imgPathNew = $img->pagefiles->path . $imgBaseNameNew; $this->colortone($imgPath, $imgPathNew, '#222b6d', 100, 0); $this->colortone($imgPath, $imgPathNew, '#f7daae', 100, 1); $this->execute("convert '$imgPathNew' -contrast -modulate 100,150,100 -auto-gamma '$imgPathNew'"); $this->frame($imgPathNew, $imgPathNew, "grunge01.png", $width, $height); //!is_file($imgPathNew) ? $this->execute($strExe) : false; $event->object->setFilename($imgBaseNameNew); return $event->object; } private function fxFrame(HookEvent $event) { isset($event->arguments[1]) ? $frameFile = $event->arguments[1] : $framefile = "grunge01.png"; $width = $event->object->width(); $height = $event->object->height(); $path_parts = pathinfo($frameFile); $prefix = $this->sanitizeFilename("_" . $path_parts['filename']); $img = $event->object; $imgBaseNameNew = $this->appendToFileName($img->basename, $prefix); $imgPath = $img->pagefiles->path . $img->basename; $imgPathNew = $img->pagefiles->path . $imgBaseNameNew; $this->frame($imgPath, $imgPathNew, $frameFile, $width, $height); //!is_file($imgPathNew) ? $this->execute($strExe) : false; $event->object->setFilename($imgBaseNameNew); return $event->object; } private function execute($command) { // echo("COMMAND INPUT: " . $command . "<br>"); $out = array(); putenv("PATH=" . $_ENV["PATH"] . ":/opt/local/bin"); exec($command . " 2>&1", $out); // echo("COMMAND OUTPUT: " . print_r($out, true) . "<br>"); } private function appendToFileName($filename, $prefix) { if ($prefix != "") { $path_parts = pathinfo($filename); return $path_parts['filename'] . $prefix . "." . $path_parts['extension']; } return "errorprefix-" . $filename; } private function sanitizeFilename($strFilename) { $strFilename = str_replace(".", "", $strFilename); return $strFilename; } public function colortone($input, $inputNew, $color, $level, $type = 0) { $args[0] = $level; $args[1] = 100 - $level; $negate = $type == 0 ? '-negate' : ''; $strColortone = "convert '$input' \( -clone 0 -fill '$color' -colorize 100% \) \( -clone 0 -colorspace gray $negate \) -compose blend -define compose:args=$args[0],$args[1] -composite '$inputNew'"; $this->execute($strColortone); } public function border($input, $color = 'black', $width = 20) { $this->execute("convert $input -bordercolor $color -border " . $width . "x" . $width . " $input"); } public function frame($input, $inputNew, $frame, $width, $height) { $strFramePath = $_SERVER['DOCUMENT_ROOT'] . "/site/modules/frames/" . $frame; //echo ("DOC LOCATION: " . $strFramePath . "<br>"); $strExe = "convert '$input' \( '$strFramePath' -resize {$width}x{$height}! -unsharp 1.5×1.0+1.5+0.02 \) -flatten '$inputNew'"; //echo ("EXE: " . $strExe . "<br>"); $this->execute($strExe); } public function vignette($input, $inputNew, $width, $height, $color_1 = 'none', $color_2 = 'black', $crop_factor = 1.5) { $crop_x = floor($width * $crop_factor); $crop_y = floor($height * $crop_factor); $strVignette = "convert \( '$input' \) \( -size {$crop_x}x{$crop_y} radial-gradient:$color_1-$color_2 -gravity center -crop {$width}x{$height}+0+0 +repage \) -compose multiply -flatten '$inputNew'"; $this->execute($strVignette); } } Outputs the attached image1 point
-
MacOSX Github App first steps Since ProcessWire modules directory supports and encourages you to use github for publishing modules and third-party content here's a little help getting started with github for mac. Go and install the app for mac here http://mac.github.com/ You'll have to first create a github account to where you can connect. Creating public repos is free, on top you'll see a "Free for open source" and a small button. https://github.com/plans Login in from your newly installed github app. Create new local repository by simply dragging the folder (your module) right into the app. The folder can be anywhere on your computer, maybe you choose to use the github folder automaticly created under ~user folder, or you decide. After you added it to github you'll see added a ".git" folder in your local repositiory. Now you'll see your files added in the app. Maybe you'll see the annoying ".DS_Store" file in there too. To ignore files simply right click on them and select "ignore". It will get added to the .gitignore file which now also appears in the files. Do the same and ignore it too. Now push the newly created repo to github using the button top right "Push to github". You'll be asked to enter a title and description then you can push it. It now will appear on github, but still empty. Now make your first initial commit, add a description i.e. "inital commit" and press "Commit" button. You'll see it add's a "Unsynced Commits" panel underneath. Press the button on top right "Publish branch" button and it will push it to the remote repository. You should now be able to see the files commited on your github page. On the repository page you'll see a "ZIP" download button. You can use that url to enter in the download field for the module when you add it to http://modules.processwire.com. Once you update the module, you have to enter a new version both in the module getModuleInfo() and on the module page. This makes sure people, also some apps using the webservice, know it is new and can update it. Screencats The following is a short screencats (no audio) showing me adding a new repositiory to github and update it using the mac github app. Screencast using MacGithubApp1 point
-
1 point
-
Just noticed that the Web Developer extension for Chrome has a 'View Responsive Layouts' option under the 'Resize' menu, which works well for a quick check. (It's also available for FF and I would expect that to have the same.)1 point
-
Well, as suggested: I would put this code in a page with a non cached template: <?php $id = $sanitizer->text($input->get->id); $whichPage = $pages->get($id); $whichPage->views = $whichPage->views+1; $whichPage->saveField($whichPage, 'views'); And in your pages / other templates you place something like this (jQuery assumed): <script> $.get("/mycounter/", {id: <?= $page->id ?> } ); </script> "mycounter" would be your counter page with the counter template. [totally untested]1 point
-
I've updated the module with some configuration options and (hopefully) clearer instructions. It is using functions from the development branch of ProcessWire but they are for convenience in template design and can be worked around (using things like page.get('field') instead of page.field for instance) if you need to run it on an older build before the development code gets merged. If there are no bugs that people find then you could call this 'finished' (ignoring any future enhancements) and should be pretty stable now. Hopefully someone finds it of use. I've been making some test sites and will be definitely using it for at least two production sites I will be starting work on soon.1 point
-
Checkboxes are always nice One reason might be that as a programmers we do think it as a property of a object, or a "feature of that page" etc... But the editor is looking the frontpage and wants to change something there. Also if there can be more than one featured items, then using page reference allows choosing their position etc. And removing items is much simpler also.1 point
-
Soon 15000 posts and 500 members. Nice growth fellows! Do we get some neat statistics from the IP.Board Pete?1 point
-
I'm not sure, but are you copying the answers as well from the later posters? First quick draft with total nonsense, then Teppo (or some other poor fellow) comes with careful examples... some copy & paste magic (with few edits of course) and voila! And final nail in the coffin is that "Sorry dude, I was first here"1 point
-
This is actually pretty interesting topic, started googling for more: http://blog.millerme...pre-processors/ Then there is this from 2009: http://nathanborror....0/sass-isnt-me/ and in comments Jeff Croft says: Forward few years and from Jeff's own blog (http://jeffcroft.com...eature-of-sass/):1 point
-
ryan: I don't want it as installable site profile; just dump my site code to github for people interested in it to see.1 point
-
Gazley: excuse WillyC, he's... special. Actually, it does; XDebug on + default nesting setting (100) give this error; More here, for instance: https://groups.google.com/forum/?fromgroups#!topic/cake-php/F6uRlDOwOvs%5B1-25%5D1 point
-
1 point
-
If anyone's interested, I've attached a screenshot of the debugging environment. PW_debug.tiff1 point
-
1 point
-
Something like this can be used to create a new PageArray $somepages = $pages->find("template=news, limit=10"); $parray = new PageArray(); $parray->add($somepages); // add one page (or also multiple since 2.2.2) // or $parray->import($somepages); // add one or multiple pages from another PageArray $parray->sort("-modified"); ... Edit: If you have an array with id's that's also cool: $ids = array(1002,1004,2303,4342); $parray = new PageArray(); foreach( $ids as $id ) $page->id ? $parray->add( $page->get($id) ) : continue ;1 point
-
I don't think that's going too far with template specific field perms ryan - could be useful on larger sites where fields are more likely to get re-used many times.1 point
-
I think these sound like good ideas. I was initially thinking the fields permission would work very similar to how it does in the Template editor (for consistency). Something like this: Setup>Fields>[field] editor would have an 'Access' tab or fieldset. It would say "Do you want to manage edit access for this field?". If No, it doesn't have anything else. If Yes, then you get a list of roles where you can check the box for the roles you want it to be editable for. When you want to do grouped permissions, you'd use a role, as their purpose is to group permissions for users. (Roles are a many-to-one relationship with users). To reuse your example, you'd name the role 'edit-private-fields' if you wanted to isolate permissions for a group of fields. I was also thinking the access could be a component of the field-template context modal dialog, so that you could grant a role access to edit the 'body' field in one template, and not in another. Though that may be going farther than we need to.1 point
-
Two useful bookmarklets for testing responsive designs: http://responsive.victorcoulon.fr/ http://www.benjaminkeen.com/open-source-projects/smaller-projects/responsive-design-bookmarklet/1 point
-
You could also create various templates for the sections, and create them as pages underneath your parent/home. The php template would be just the section html markup with some content from the page. <section> <h2><?php echo $page->title; ?></h2> <?php echo $page->body ?> <img src="<?php echo $page->image->size(100,100)->url; ?>"/>; </section> Then in your top page (home) php template you'll be able to render them out simply with something like: foreach($page->children() as $p){ echo $p->render(); // will render the above }1 point