Leaderboard
Popular Content
Showing content with the highest reputation on 11/27/2012 in all areas
-
While I more than welcome the inclusion of 'Required' and 'Placeholder' support for input fields, I think one element that would be very useful would be 'Pattern' support. (Just in case anyone isn't aware, modern browsers can validate input based on a regex.) Of course client side validation is no substitute for server side validation, but the same regex can be used server side, too.3 points
-
Hi, http://kudlek.com/ this is my second project with PW and one I like in particular. I made this side in Textpattern but migrated it as my client wasn't happy with what he got from TXP (and me neither). There is nothing very special on this site but some gimmicks needed my attention such as the exhibitions archive. I enjoyed it very much to work with PW and the endless flexibility it has to offer. There were no limits. My client is very happy with the system. I have Ergo admin theme installed. Best, Christoph3 points
-
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/41509743 points
-
Anyone here installed Piwik 1.9.2 recently? If so, check your installation for a possible backdoor that it may have contained. The download server was compromised and a backdoor injected into the downloadable. Background, including basic cleanup instructions, via the-H (includes links for more info).2 points
-
function instant($object) { return $object; } instant(new SomethingOrAnother)->size('big-like-hell')->render();2 points
-
The error message doesn't look like a problem with the host to me... maybe there was some problem when copying or unzipping the files? edit: just noticed that this was my thousandth post2 points
-
I did forget to update this: there was an actual issue that is fixed now on latest commit. Thanks Arjen for finding and Teppo for fixing!2 points
-
Not sure if this has already been suggested, but for the less php literate among us it would be great to have some sort of repository of php scripts on the PW website for formatting template data, i.e. the php snippets for outputting different kinds of menus, breadcrumbs, bloglists, etc. Similar to a database or list of modules, but specifically for the templating side of things, where you don't require a full-on module. Right now you have to scour the forums (or write your own code) if you're looking to do something beyond the basics that are included in the default templates.1 point
-
Yes, but I think Soma is reporting to this post from Apeisa http://processwire.c...ine/#entry12629 I tried to answer without modifying your code too much, but I admit it came out kind of ugly. Soma's code is much better edit: also, if someone has troubles to understand these <? if(count($page->gallery)): ?> , <? endif; ?>, just have a look here http://php.net/manua...tive-syntax.php1 point
-
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.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
-
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.1 point
-
Some PW template syntax to the table? <? if(count($page->gallery)): ?> <h6>Images</h6> <? foreach($page->gallery as $slide): ?> <a rel='prettyPhoto[pp_gal]' title='<?= $slide->gallery_caption ?>' href='<?= $slide->gallery_image->url ?>'> <img class='peKbGallery' data-delay='<?= $slide->gallery_delay ?>' src='<?= $slide->gallery_image->url ?>' alt='<?= $slide->gallery_caption ?> (Click to enlarge)' /> </a>"; <? endforeach; ?> <? endif; ?>1 point
-
if($page->body){ //not empty }else{ //empty } other options if($page->body) echo "body not empty"; if(!$page->body) echo "body empty"; for the second question: <?php if($page->gallery->count() > 0){?> <h6>Images</h6> <?php foreach($page->gallery as $slide) { echo "<a rel='prettyPhoto[pp_gal]' title='{$slide->gallery_caption}' href='{$slide->gallery_image->url}'> <img class='peKbGallery' data-delay='{$slide->gallery_delay}' src='{$slide->gallery_image->url}' alt='{$slide->gallery_caption} (Click to enlarge)' /> </a>"; } } ?>1 point
-
You could use the count function: if(count($page->gallery)) { // here your code (for displaying h6 ...) } else { // ... } For more information look at here http://processwire.c...ypes/repeaters/ or here http://processwire.c...pi/arrays/page/1 point
-
The things I think are time savings: Take your time to study the Blog profile & read the delegate approach article are time consuming at first, but a big time saver after all. Learn some basic regex. Using the right css framework for a specific job. (I like Zurb Foundation & Skelleton) Study a lot !1 point
-
I love SublimeText2. If someone experienced with ProcessWire were to share some snippets for general use, I think that would really help many users.1 point
-
I have just finished (ish) my first Processwire website: http://www.stonywebsites.co.uk/ It is a very basic site, but it uses Twitter Boostrap for the framework and also the Bootstrap Carousel on the front page. Graphics are all mine, though I am no artist, I am a writer and composer, so be kind. This was a rebuild of a site that was originally on Joomla with Seblod, but I decided to move to PW. One Problem: I used the Profile Exporter to move the site from development. But I had one issue - the paths to the images were wrong. The site was developed in a sub-directory on my local machine, and the image paths had that sub-directory as part of their address. I assume that on the dev site I had something wrong somewhere - what should I have done to stop this happening? Joss1 point
-
I don't have this as a requirement on any current projects, but this would be a great addition! Some nice patterns: http://html5pattern.com1 point
-
And at 7am too... God that's early for a web guy! On another note, I was battling away with a jQuery problem all afternoon yesterday and I went to bed really annoyed that I hadn't been able to sort it, I'd just turned out the lights and the problem starts going round my head again, then I had a Eureka moment, jumped out of bed and went and sorted it - went to bed well chuffed! That's the thing I find hardest about this job, leaving things unfinished at the end of the day...1 point
-
:'(You made me curious, but my ajax search module still works with dev branch.1 point
-
The profile was originally build for an older version of ProcessWire and I think Ryan has it on it's to do list. Since it's not really useable you should consider installing the blog profile. Tons of stuff to learn from there!1 point
-
Well I've made a start on one for real estate (a slow start) and already come to the realisation that needs for this profile in the UK and USA will be different as well as in other countries. The good thing is though that we're not talking about a module or a plugin from some other system - it's just fields and templates for now - so as long as I comment the relevant areas properly it's easier than any other system to alter the fields and customise it all.1 point
-
I came across this recently. Responsive CSS Framework Comparison Bootstrap vs. Foundation vs. Skeleton http://responsive.vermilion.com/compare.php1 point
-
…and another update, the default admin theme is now responsive. Though I'm sure I'll be tweaking details on this for awhile.1 point
-
FANTASTIC theme! Really love the color scheme, it's very soothing Mr. Nikola. I made a few minor changes to 'main.css'. #latest { text-transform: capitalize; } #latest-updates ul { width: 240px; } #latest-updates ul li { margin: 0 0 0 20px; } #latest-updates ul li a { display: block; } #latest-updates ul li a:hover { border-right: 5px solid #0fa8da; padding-right: 5px; } I just like having the Latest Update post links as blocks. It makes for easier clicking1 point
-
1 point
-
Oh, a note to Ryan: This site is interesting because it is a direct rebuild, almost word for word, of a Joomla website. Doing some very rough tests this morning, it is MUCH faster than the Joomla version. So, plaudits to you for your core software. Joss1 point
-
[Reviving an excellent topic] I've been trolling around here for a while now. I have yet to launch a ProcessWire site. But I truly find the support and users here to be among the friendliest around. A central repository for common and useful snippets would help me and many others new to ProcessWire1 point
-
I don't think it's possible with a selector to recieve pages that have one specific month (across years). Your solution is the only I can think of. However you could write an helper function to just be able to use $pages->findPeopleBorn(9); to keep template code thin. A module with a hook $this->addHook("Pages::findPeopleBorn",$this,"findPeopleBorn"); which then has a public method findPeopleBorn($event) that returns results would be a good way to do this. See "HelloWorld.module" for example. One way to archive it without going through all users would be to separate day,month,year into their own fields. This would be easy to then query all pages with a specific month via a simple find(selector). Or a custom mysql sql query to recieve the id's and load the pages from that. Assuming the date field is called "birthdate": $tmplID = $templates->get("people")->id; $month = 8; $query = " SELECT field_birthdate.data,field_birthdate.pages_id FROM field_birthdate LEFT JOIN pages ON (field_birthdate.pages_id=pages.id) WHERE (EXTRACT(MONTH FROM field_birthdate.data) = $month) AND pages.status < 2048 AND pages.templates_id=$tmplID ORDER BY pages_id"; $res = $db->query($query); if($res->num_rows){ $ids = array(); while($u = $res->fetch_array()) $ids[] = $u['pages_id']; } $ids = implode("|",$ids); $people = $pages->find("id=$ids"); foreach($people as $p){ echo "<p>$p->title</p>"; }1 point
-
Clients usually love PW, exactly because of the reasons we stated. The worst type of clients, the almost tech-savvy ones, usually like the videos/idea of CMS, where you push 8 buttons and have everything set… then you show them the admin screens and they flee in panic. And when it comes to clients who are willing to compromise on the quality, just so they can use some technology… Well, I try to catch this early on, and just end the relationship, then and there.1 point
-
Well said Matthew, the end result of PW website is really up to you, not what the system comes up with. That being said, I have been thinking a lot about building our own "starting profile" (we kind of have one already, but that is not well build). Something more "out of the box" for our clients. That thinking also has some merits - especially if there are lots of sites and multiple people working (also on different areas, like customer support, developing, sales etc). More feature packed default site is easier to demo and sell, easier to maintain if there is lots of similar sites, easier to provide support (technical and helpdesk), easier to write instructions etc... What I am doing (hopefully this year) is to build site profile where would be the most common needs baked in already. What that would mean in our case (we build websites for Finnish associations) are: News section Events section Contact section Few different "basic-page" layouts Blog (maybe) FAQ-section (maybe) Tiny "intranet" section (maybe) Frontpage highlights Few editor roles Some useful modules already installed (redirects, adminbar, link helpers, admin helpers) Using more robust template approach Responsive by default I hope that it won't take too long that we start to see more and more community driven "starting profiles" like Ryan's Blog profile. There could be things like General CMS profile (kind of what I am doing - although not sure if it will be general enough to share it) and E-commerce site (kind of what here is coming) etc..1 point
-
This is not specific to PW projects, I would use the same approach or techniques for plain HTML sites or projects with a blog system. This is because I always start with an HTML prototype which later is converted into a PW template. I actually have … well, I wouldn't call it a framework, but a “starting point”, a boilerplate. This is derived from the HTML5 Boilerplate and combined with some basic CSS and JS stuff. Just some reliable CSS (see later) snippets and jQuery plugins I use often or all the time. Having (and knowing) that helps a lot, but beware - it can result in repeating yourself in your designs. I also have a (small, but growing) collection of PW snippets, most of them stripped from the default page profile or used in projects. (Also saves me having to look it up in the forum again.) Two other things which have really helped me to save time … well, it's not so much about actually saving time, but more about saving nerves by not having to manually do things … anyway, it's using a CSS preprocessor (I prefer Sass/Compass, but I honestly think it doesn't make a big difference if you prefer LESS or Stylus) and a build process to automate things (I have recently switched to a Grunt-based build system, but other build scripts should work just as good) like combine/minify CSS/JS, optimize images etc.1 point
-
Looks like there are a few other CMS's (including perch) using Redactor WYSIWYG editor. I'm jealous seeing the other kids playing with a toy that I want and don't have. This came up before in another topic, and it sounds like there are possibly some licensing issues. Thought I'd start a topic specifically to discuss this—incase there is any possibility of adding it to Processwire. I don't have enough knowledge about the licensing, or the skills to turn this into a module—but I make a great cheerleader! Wait... that didn't sound right.1 point
-
My first contact to a preprocessor was "turbine", a PHP based one which is quite comparable to stylus and SASS. Now I use stylus for every project. I don't like curly brackets, I don't even need colons. For me it is really pain in the a.. to modify older projects or projects from others which use plain CSS. I am writing my CSS pretty fast and the cascading is so much easier to follow once written. Since one writes HTML from the outer elements to the inner ones, I am very comfortable with writing CSS the same way. For example: <header> <nav> <ul> <li> <a>home</a> </li> <li> <a>products</a> </li> <li> <a>services</a> </li> </ul> </nav> </header> isn't it natural to write the CSS the same way? header max-width 1280px height 200px margin 20px auto padding 10px position relative nav width 750px right 0px top 100px height 50px position absolute > ul > li float left position relative height 50px display block line-height 50px text-align left padding 0 20px transition(all 0.3s ease-out) background weisstrans > a headline(18) white-space nowrap padding 10px 0px transition(all 0.3s ease-out) &:hover, &.active background blautrans transition(all 0.3s ease-out) You also see other benefits like mixins, variables and so on. I would miss the advantages a lot, really! And it doesn't matter if LESS, SASS or stylus. You will never go back, promised! Sorry, indentation is wrong with this forum editor, but I think you get it.1 point
-
Oh my god, you're such an oldschoolers. LESS/SASS FTW! And let me repeat myself: you don't have to go to to CLI to install nothing. There are simple apps for everything; And there are even more advantages, if you design in browser, mainly variables. Also I find something like this much easier on the eyes: font: 1em/2.5em $family; // make it or for1 point
-
Just my two cents: First of all, when I first started to get into LESS and SASS, I found LESS documentation more "newbie-friendly" -- or perhaps just "friendly" in general -- and that's a big part of why I was instantly drawn into it instead of SASS. Not the best way to choose your tools, but that's still how it often goes.. The main reason why I haven't used LESS (or SASS/SCSS) in customer projects is that we have multiple people working on same projects, sometimes at the same time, so 1) compiling locally and just uploading a compiled CSS file isn't really an option (I'm not even considering letting JS handle compiling on a production site) and 2) I can't just jump in the LESS/SASS/SCSS bandwagon by myself without discussing it properly with others or I might have some serious explaining to do later on. I do know that LESS can be compiled server-side with the help of Node and now that the PHP version was mentioned (thanks Marty!) I'm likely going to check that one out too, although the final deployment process still requires some thought. Anyway, I'm sad to say this but all the hassle has already made me somewhat cynical about whether we really even need the added complexity and overhead compared to plain old CSS. Is it really THAT difficult to keep pure CSS files up to date? In my experience the answer is "very rarely" and I'm saying this even though I've worked with some seriously bloated relatively big stylesheets before. LESS/SASS/SCSS/whatever are definitely an improvement over plain old CSS, too bad they're not natively supported by browsers but require various tricks and gimmicks to run smoothly. Just saying. Sorry for the rant and sorry for getting sidetracked. This is an interesting subject both in technological and theoretical sense and those always tend to get me on my toes. One of these days I'm definitely going to try LESS on a "large-scale" site just to get a better view whether or not it's really worth it -- until then the rant above pretty much summarizes how I feel By the way: have you guys already seen the W3C draft for CSS Variables? It's not the same thing as these frameworks mentioned here, but it is a small step to the same direction: http://dev.w3.org/csswg/css-variables/.1 point
-
Funny thing: I use Sass/SCSS because (for me) it's less hassle to use over LESS or Stylus. I have yet to manage setting up a local nodejs server on my Ubuntu machine. Setting up Ruby is very easy, so my choice of using Sass was not at all related to the actual features of the preprocessor. As far as I have looked at other preprocessors, it doesn't really make a big difference anyway. Stylus has a much more concise syntax, which might be the reason I'll check it out one day. Sass has the Compass library, which I use, but not extensively. I prefer to write my own mixins and only use Compass for the complicated stuff and for CSS3 features which are still subject to change. My workflow probably wouldn't change much if I had to use LESS or Stylus from now on. Personally, I wouldn't want to go back to writing plain CSS, but that's another option, of course. I feel it has simplified my workflow massively, but like everybody else, I was sceptical at first, but now I can only recommend giving it a try. It really makes a lot of things much easier and less time-consuming.1 point
-
I have used a lot of CMS in the past, but it seems I have developed a very special taste which narrows down the list of candidates pretty quickly. If the CMS generates markup, it has to be editable. Easily. Preferably it has a "no default markup mode" or something. Markup's my job. If the CMS has templates, they should have a physical representation, i.e. template files, not just templates stored in the DB. If I can't edit it with my favorite editor, it's not a template. If the CMS comes with a CSS framework, it has to have an option to disable that framework. I want to be able to use "my" CSS. If the CMS uses a default JS library in the frontend, it better be jQuery. I don't care what you use in the backend, but I don't get MooTools and all that other stuff. If you use ExtJS, you're out. It's slooooow. Open Source only. Paying a suitable fee is okay, but you better let me have a look at your code. That being said, I have seriously evaluated, tried and use(d) MODx, Contao, Drupal, Perch and ProcessWire over the last 2 years or something. (I don't count blog systems as CMS, not even Wordpress. If I need a blog engine, I use Serendipity.) MODx, Contao and Perch all either collide with one or more of the 5 points above and/or have made some weird development or license choices I don't like. So I guess if I had to use another CMS, I'd go with Drupal. (I hope I never have to, though.)1 point
-
I was thinking it would be good if it was something people could contribute to fairly easily. I'm sure that a lot of ProcessWire users here have accomplished a lot of really cool things inside of their templates using the API, and if there were a central place that they could then submit those for the benefit of others, that would save people having to re-invent the wheel or ask on the forums. Which leaves more time for Ryan and others to work on the core and various modules Some kind of basic gatekeeping/moderation would probably be necessary to ensure a minimum quality standard for the scripts.1 point