Leaderboard
Popular Content
Showing content with the highest reputation on 11/23/2012 in all areas
-
I don't know the drawbacks of this, but I just managed to do make the dynamic stylesheet proposed on css tricks work has a pw template. So, this is how to do it (someone stop me if this is a bad bad thing to do): 1. Create a template file css.php and put all your css code inside. On the top of the file put this code <?php header("Content-type: text/css"); ?>. 2. Create a "css" PW template with that file. 3. Create a "css" page and give it the "css" template. 4. Link to the stylesheet like this <link rel="stylesheet" href="<?php echo $pages->get('/css/')->url; ?>">. 5. use the PW API on your stylesheet Extra: 6. put some fields on the "css" template and use them on your css Examples: the color picker field for colors; an image field with your style pictures (background, logo, etc). edit: onjegolders was faster! edit2: not the same answer. Mine is more interesting1 point
-
If you want to access the processwire api from external scripts you have to include processwires index.php there see here: http://processwire.com/api/include/1 point
-
It would be a matter of couple php lines to import those data to a repeater or pages. Also everything about repeater you should know is well described here: http://processwire.com/api/fieldtypes/repeaters/1 point
-
in templates you can do $results = $db->query("SELECT * FROM yourtable"); or in modules $results = $this->db->query("SELECT * FROM yourtable");1 point
-
Thanks onjegolders, I thought I had set the date/time format but on checking it was not so that is now fixed as well. For anyone this may help the code is now: foreach($page->children as $event) { foreach($event->groups as $group) { echo "<div class='event_listing'> <h2><strong>{$event->title}</strong></h2> <p><strong>Group:</strong> {$group->title}</p> <p class='fltlft'><strong>Starting:</strong> {$event->start_time}</p> <p><strong>Ending:</strong> {$event->end_time}</p> <p><strong>Description:</strong> {$event->element_description}</p> <p class='fltlft'><strong>Contact Name:</strong> {$event->contact_name}</p> <p class='fltlft'><strong>Telephone:</strong> {$event->telephone}</p> <p><strong>Email:</strong> {$event->email_address}</p> </div> <div class='clearfloat'></div>"; }} ?>1 point
-
Hi Noose, 1) A page field which holds multiple pages is an array and therefore you need to loop through them foreach ($event->groups as $group) { echo "<p>$group->title</p>"; } 2) You need to set a date output on your date field in the admin area. You will be able to choose different outputs there.1 point
-
Ops, ok that's a little different then but still same concept. Then you can do something like this? $class = "item"; foreach ($galleries as $gallery) { $status = ''; if ($gallery === $galleries->first()) { $status .= " active"; } $class .= $status; ... Don't worry we all do it wrong from time to time, even if you done it many times1 point
-
if ($gallery === $galleries->first()) { This is correct code with ===! Your problem is you have the "active" already in variable after first time. SO correct is: foreach ($galleries as $gallery) { $class = ''; if ($gallery === $galleries->first()) $class .= " active"; ... Problem solved. Easy if you think enough about it1 point
-
Concerning the pixlr module, I just wanted to add aviary to the discussion. I always liked aviary tools, and their web widget does seem nice http://www.aviary.com/web1 point
-
In my humble opinion, Pixlr serves a specific purpose: it's probably very useful for occasional image adjustments, and apparently is quite powerful. And I see a couple of major problems with it: It's Flash-based, so it's obviously not a future-friendly solution. Flash is dying on mobile devices since Adobe officially killed it (it never really was an option anyway). Who cares, you might say? Who would want to edit images on a mobile device from a PW admin? Well, I already have a couple of clients who are literally in the "post-PC era": they do all their work on tablets. Don't ask them to edit their sites on their laptops or desktops: they don't have one anymore. Most of us might think this is a strange idea to edit a PW site on a mobile device, but this is already happening, and whether we like it or not, it's very likely to become the norm within a few years. I can't just ask my clients on high-traffic websites to open an image-editing module dozens of times each day and hunt for the sharpening tool each and every time that they upload a new picture. They wouldn't do it, and I wouldn't blame them. I wouldn't want them to mess with the other filters either ("I put it all my pictures in sepia because they look prettier that way"). Image sharpening is the only nagging "issue" I have with PW for all the image-heavy sites that I'm developing. Admittedly, most users wouldn't notice that pictures are slightly blurry. But I do, and it bothers me. I want my sites to look as good as I can make them to be, not just acceptable. I'm sure most of you share that philosophy. I can get around the problem by enforcing crops in apeisa's excellent module at a larger size than required and then shrinking the image in my HTML or CSS, but it's not a good solution. It seems to me that image sharpening should be a configurable option globally (whether as a module or included in the core), just like image quality now is.1 point
-
I'm having trouble figuring out why would a repeater be needed here? A plain file field allows you to upload multiple files with descriptions - do you need something more? Maybe I just didn't get it. If you've got field "files", you can iterate files in it like this: foreach($page->files as $file) { echo $file->url; echo $file->description; } So almost what you already had there. Then, check Setup -> Fields -> "files" -> Details -> Valid file extensions to see which types of files are accepted by your field - that setting might explain why certain files are rejected. I hope this helps.1 point
-
YOu could do it like this and add a jscript file and use the action to copy to clipboard or make a prompt: PageListPath.js $(function(){ $('.PageListActionURL a').live('click', function(e){ e.preventDefault(); console.log($(this).attr('href')); copyToClipboard($(this).attr('href')); }); }); function copyToClipboard(text) { window.prompt("Copy to clipboard: Ctrl+C, Enter", text); } And the module code <?php /** * PageListPath 0.0.1 ProcessWire module * * @author Arjen Blokzijl * @created 22/11/2012 * * ProcessWire 2.x * Copyright (C) 2010 by Ryan Cramer * Licensed under GNU/GPL v2, see LICENSE.TXT * * http://www.processwire.com * http://www.ryancramer.com * */ class PageListPath 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' => 'Page List Path', 'version' => 001, 'summary' => 'Adds the path to the page', 'autoload' => true ); } public function init() { $this->addHookAfter("ProcessPageListRender::getPageActions", $this, 'hookPageListActions'); $this->addHookAfter("ProcessPageList::execute", $this, 'addScripts'); } public function addScripts($event){ $this->config->scripts->add($this->config->urls->PageListPath . "PageListPath.js"); } /** * Hook into ProcessPageListRender * */ public function hookPageListActions(HookEvent $event) { $page = $event->arguments[0]; $actions = $event->return; $actions[] = array( 'cn' => 'URL', 'name' => 'url', 'url' => "$page->url" ); $event->return = $actions; } }1 point
-
1 point
-
This is great -- thanks for making this translation! Nice to see a new translation here.1 point
-
Today I started to develop the project. And what should I say? The API is so fantastic, I love it! As first I startet the development of the user management. At the moment I have a page called "profile". Here is a if-statement, which check the session status. If TRUE you will be able to see content. (Nothing generated yet) If false you can choose between login and registration. In the registration process you can insert username, email and password. The user will be added with the status inactive. A mail with a confirmation code will be sent to the email-address and after the confirmation the user is active. Everything worked finde at the moment and I think in a few weeks I will post this community project to the showcase. Many thanks for your input at the beginning, it was a good start in understanding for me. z.1 point
-
If you are doing this in a template file, better to use some name other than $page, just so that you don't overwrite the $page provided to the template. $p = $pages->get('/about/'); if(!$p->id) { // create new page, if not already there $p = new Page(); $p->template = 'basic-page'; $p->parent = '/'; $p->name = 'about'; // URL name } $p->of(false); // turns off output formatting $p->title = 'About SwimToWin'; $p->save();1 point