Leaderboard
Popular Content
Showing content with the highest reputation on 06/19/2013 in all areas
-
What funny title.. I lol'd. It should be "WP got hacked need PW 2.0". I almost got a heart attack.4 points
-
Hey guys of central europe and near Switzerland. Any interest in doing a conference/meeting in Switzerland, this year or any time in the near future? I was thinking about a location in Zurich. Event if it's just to meat and eat, drink and have some fun.2 points
-
@Horst - it is more of my limited brainpower in this tropical heat, you've linked me to good content though. Thanks. @Kongondo - you're such a disappointment. --- On a more serious note, ->sort() works. But you can enter just one repeater field (not multiple, as I've tried, although that seems to be in the works, as @Ryan noted in the code ), and the field must exist (yeah, that one's on me).2 points
-
Yeah prev and next does only traverse inside a parent. But there's plenty traversal methods to get around it. $nav = ''; if($page->prev->id) { $nav .= "<a href='{$page->prev->url}'>prev</a> | "; } else if($page->parent->prev->id && $page->parent->prev->is("template=month") && $page->parent->prev->numChildren){ $nav .= "<a href='{$page->parent->prev->children->last->url}'>prev</a> | "; } if($page->next->id) { $nav .= "<a href='{$page->next->url}'>next</a> | "; } else if($page->parent->next->id && $page->parent->next->is("template=month") && $page->parent->next->numChildren){ $nav .= "<a href='{$page->parent->next->children->first->url}'>next</a> | "; } echo trim($nav," | "); Maybe need to adapt to your situation, but it's straight forward and everything is possible.2 points
-
AdminSaveActions (Was: After Save Actions - guess why the rename?) Admin Save Actions adds the possibility to choose where the browser gets redirected after saving a page, template or field. Admin save actions are displayed just before the save button in a collapsed container. Chosen action can be saved in a cookie for current user by checking "Remember this setting". By leaving this option unchecked upon save, the chosen action will not become the default. Why? Some of you wanted something like this to exists in ProcessWire - and so did I. I've read discussions here, here, here and here carefully trying to cover at least most of the options discussed. I know this implementation wont satisfy all the needs, but I'm looking into adding some things afterwards to cover even more of them. I called the first version of this module PageEditRedirects but decided to to change the name in to a more descriptive one. So that module got deprecated as of now (and does not exists at GitHub anymore). This new version also does not require PW 2.3 but works just fine on PW 2.2 as well. Special thanks A module by Adam Kiss (ListAfterSave) implemented some of these actions a long time ago. Thanks to Adam for letting me use the ideas introduced by his module. There are actually some things there my module isn't going to cover even in future versions. Links AdminSaveActions can be found from the modules section. AdminSaveAction is downloadable from GitHub. (Edit: added link to the modules section. Edit 2: Implemented config option + version bump. Edit 3: Removed feature list - see GitHub.)1 point
-
You need to get some sleep! We all do!1 point
-
@Ryan: I have done a big mistake! I have exported the wrong DB-Version. I have local setup pw3b.host.local with DB pw3b pw3c.host.local with DB pw3c and it should be pw3d.host.local with DB pw3d They are different Branches of the same site. But I can't remember why and when, I have switched pw3d.host.local to work with DB pw3c instead of 3d. I'm so sorry that I have wasted your time!1 point
-
1 point
-
@totoff is probably right and his answer makes a lot of sense in this context. Just wanted to add one slight clarification (I hope..) from my point of view: Generally speaking it would be a very bad idea to have directory containing a subdomain inside directory containing main domain -- if we're really talking about subdomains (webapp.mydomain.com) and not directories under main domain (mydomain.com/webapp/) here, that is. That kind of setup will only result in logical (ie. what happens when you navigate to mydomain.com/webapp/) and practical (ie. running ProcessWire inside ProcessWire) problems. A subdomain doesn't have to have anything in common with your main domain (it's another domain after all) and it's definitely nothing like a sub directory, which is your current setup seems pretty messed up to me. If possible, something like this would seem better option: /www/mydomain.com/ /www/webapp.mydomain.com/ .. or perhaps this, which is what one webhost I'm using does (though I've no idea why): /mydomain.com/www/ /webapp.mydomain.com/www/1 point
-
Don't know if you guys already recognized that you can now open a page in the page tree by double clicking the title. It's in since a couple months and I think, including me, didn't recognize it's there. Have a nice day!1 point
-
in this case, the only possible answer - as far as i my knowledge reaches - is, that /wepapp isn't the document root for your subdomain - as mademyday mentioned. however, the most service providers allow to point a subdomain to a specific directory on your server. or in other words to make this directory/folder the default folder ("document root") for this subdomain. note that webapp.mydomain.com is a subdomain, while mydomain.com/webapp is not. your provider should have given you some kind of service portal, where you can order subdomains and fulfill other tasks. make sure, that your new subdomain is set to /wepapp as default folder in this portal.1 point
-
1 point
-
Without knowing what script you use (custom built or downloaded) you could also add the image directly to the html and hide it. Then use it in you js and make it visible when you need it. Or you can add a data-url to a DIV tag and read that from the javascript. <div id="topimage" data-url="<?php echo $config->urls->templates . "img/top.png"></div> And in your javascript with using jquery var img = $("#topimage").data("url");1 point
-
I develop it so I never have to change it. I never develop in a different structure than on dev and live... But if you do so and change root directory or have in a subfolder and on live not, you'll have to take care of image paths and link in PW anyway So one way is to pass the root path you can do so by passing it to js via a script in the header template. <script> var config_root = "<?php echo $config->urls->root ?>; </script> then in your .js files you can use var img = config_root + "site/templates/img/whatever.jpg";1 point
-
Wow! Adam has put me in privileged company!!?! My two minutes of fame . I couldn't code my way out of a brown paper bag if I was put in one! Hehe. Sorry, your query is way above my pay grade....1 point
-
PHP should work in .js file (url: <?php....?>...but if it is a PHP file that's outside the PW system, most likely you will get a 403 since PW doesn't allow direct access to some folders using your own PHP files.. (if that makes sense ) It's been a long day! See below...1 point
-
It sounds to me like no error is actually being generated by anything. You mentioned that you got this "Error retrieving Twitter status: 0". That indicates that oAuth didn't report any errors, since it's now reporting the status of the JSON decode. A status of 0 means json_decode() reported no errors. Unless you literally don't have any tweets on the timeline you are checking, chances are that we are getting tricked by the cache. Try disabling the cache by setting the # seconds to 0: $t->cacheSeconds = 0; Any change in the errors? -- edit: Ah, no tweets. Glad you found it.1 point
-
I've tagged release 1.0.0 and the module is now listed in the modules directory.1 point
-
Actually on the original update it said it was compatible with 2.2.9, as I thought it was at first. I realized later that day it wasn't and updated. So it's my mistake, not yours. You might need to enable debug mode. Also check here to make sure that your server is compatible with the requirements/dependencies listed: https://github.com/themattharris/tmhOAuth1 point
-
That error translates to "Unexpected use of double colon". It's not something that should matter between PHP 5.2 and PHP 5.3, and that particular block of code hasn't changed. (though there have been other changes in Modules.php, and maybe this is a side effect?). That error can occur when there is a module file that is named differently from the class within it. This is why PW requires that a module class HelloWorld be contained in a file called HelloWorld.module. It's unusual for sure, I'm not sure what the issue could be. Do you know of any other differences in the server setup? Opcode cache or some other PHP stuff going on? It might be good for us to look at the phpinfo() output. Also, what 3rd party modules do you have installed? If you could PM me any relevant info to login via FTP, and to your PW admin, I should be able to debug this.1 point
-
@kongondo: Thanks for the request - and sorry for the delay. I've been a bit too busy lately and unfortunately will be in the near future as well. That feature has been on my todo-list since the first version of this module though. While it's straightforward to add, I'd like to come up with a decent solution for situations where there are a lot of siblings as well. I'll try and find some time to try this out as soon as possible.1 point
-
I think I have read somewhere in the forums people say if it is fixed and won't change, why waste PHP resources? Stick it in the template file . Up to you ultimately...1 point
-
Why not create a custom login? The only reason to not give them admin access is if they're just front-end users. I wouldn't want my front-end user loging through processwire admin login. If you give the user no edit rights in roles they can't access the admin and get a "continue" link after login Even if you want them to manage content from frontend only I would take that route as the permissions can be defined on the fly in your temlates. The other way would be as kongondo mentioned, and here's a code you could put in a autoload module (like HelloWorld.module). ready() is used because it get's you access to all API. public function ready() { if($this->page->template == "admin") { if($this->user->hasRole("editor")) { $this->session->redirect("/somapge/"); } } }1 point
-
Perhaps I misunderstood, but why not point the subdomain to a separate folder with your application in it? So the server redirects requests to this folder and PW has noting to do with it.1 point
-
1 point
-
1 point
-
1 point
-
adrian - you are right! thanks Quick glance - do you need to have: $first_page = $siblings->first()->id that was the problem1 point
-
Nobody? Ok, since the tags introduced to the image field is just a plain text field, there's no other way than to loop all pages that have images loop all images to grab all tags, parse them to array and merge them. This gets you there but doesn't scale well. (Would those tags be page relations it would make it very easy to output all tags. I'm more of a fan of using page fields for tagging, but there's no image field with page tags and I use different image system if there's a lot of images with tagging and galleries. My ImageManager is one of the tools to have a page as image and you can attach as many fields to the image template to get those things done.) I often thought about what would be the best ways, with words in text fields all over the site, to collect them and I think you have two possibilities. Raw SQL query, or the above loop all pages and make that a markup cached snippet, if the amount and time to generate the list takes long, that runs every other day or hour. Also have as many restrictions, for template or parent, as you can get to make the query a little more efficient. To show what would be the API way you already got a good start and intuition with 2 foreach. The following collects all tags and makes a unique array to create a link list. EDIT: You can use url segments or GET parameter for the links. Since PW urls doesn't allow special chars there's a workaround inside the code now. /** * collect all tags * ====================================== */ $alltags = array(); // container $use_urlsegments = false; // find all pages that have images with tags $parray = $pages->find("template=basic-page|gallery, images.tags!=''"); // loop pages found and collect tags from images foreach($parray as $p) { // find all images that have no empty tags, yeah you can // also use find on Pagefiles array! $images = $p->images->find("tags!=''"); // loop them and add tags to array foreach($images as $im) { $tags = $im->tags; // convert "," and "|" to space and create array using explode if(strpos($tags, ',') !== false) $tags = str_replace(',', ' ', $tags); if(strpos($tags, '|') !== false) $tags = str_replace('|', ' ', $tags); $tags = explode(' ', $tags); // convert tag value to a page name using beautifyer, ü => ue, ö => oe // since special chars are not allowed in PW urls foreach($tags as $tag) { $alltags[$sanitizer->pageName($tag, Sanitizer::translate)] = $tag; } } } /** * generate links with tags as urlsegment * ====================================== */ // make the array unique and create a tags nav from it // add tags to the url of the page to later read it and // render a list of pages echo "<ul>"; foreach(array_unique($alltags) as $key => $tag) { if($use_urlsegments) { echo "<li><a href='{$page->url}$key'>$tag</a></li>"; } else { echo "<li><a href='{$page->url}?tag=$tag'>$tag</a></li>"; } } echo "</ul>"; /** * find all pages with the supplied tag * ====================================== */ // enable url segments on the template if using url segments if($input->urlSegment1 || $input->get->tag){ if($input->urlSegment1) { $tagvalue = $input->urlSegment1; // get the original tag value text from the cached array $tagvalue = $alltags[$tagvalue]; } if($input->get->tag) { $tagvalue = $sanitizer->selectorValue($input->get->tag); } // find pages with images having the requested tag $pa = $pages->find("images.tags~='$tagvalue'"); if(count($pa)) { echo "<h2>Pages found</h2>"; echo "<ul>"; foreach($pa as $p) echo "<li><a href='$p->url'>$p->title</a></li>"; echo "</ul>"; } } What was the other question again? And of course also found in my ever growing gist archive https://gist.github.com/somatonic/5808897 I'm too lazy to brew a SQL that does the collecting part. But there's people more clever than me that can help.1 point
-
@k Without knowing further details/context, why not just build your own menu? It can be as simple as $menu = "<ul>"; foreach($pages->get("/sompath/")->children as $child) { $menu .= "<li><a href='#'>$child->title</a>"; if($child->numChildren) { $menu .= "<ul>"; foreach($child->children as $subchild) { $menu .= "<li><a href='#{$child->name}-{$subchild->name}'>$subchild->title</a></li>"; } $menu .= "</ul>"; } $menu .= "</li>"; } $menu .= "</ul>"; echo $menu; If you still want to go the module way, yes there you could make a hook to archive what you want. There's a couple examples in this thread, but there can't be enough I guess function hookTagsString($event){ $child = $event->arguments("page"); if($child->template == "form"){ // some check for template? as you like // now return your own link markup with $event->return $event->return = "<a href='#{$child->parent->name}-{$child->name}'>-$child->title</a>"; } } $nav->addHookAfter("getTagsString", null,'hookTagsString'); // render the navigation echo $nav->render(null, null, $pages->get("/somepath/"));1 point
-
This can get really creative, as Ryan would now maybe come with something like: $nav = ''; foreach(array("prev","next") as $dir) { if($page->$dir->id) $nav .= "<a href='{$page->$dir->url}'>$dir</a> | "; else $nav .= "<span class='inactive'>$dir</span> | "; } echo trim($nav, " | ");1 point
-
There's an easy way to strip off chars with php method trim(). But in this case it can get tricky. Also regarding PageArray and explode doesn't really play a role here... But it sinks in better if you make faults. I think an idea would be to do: $nav = ''; if($page->prev->id) $nav .= "<a href='{$page->prev->url}'>prev</a> | "; if($page->next->id) $nav .= "<a href='{$page->next->url}'>next</a> | "; echo trim($nav," | "); Fairly easy concept. Depending on how and where you use it, this way it can get annoying as you get jumping link elements. You get sometimes "prev" sometimes "prev|next" links So maybe add some logic to show only a span when there's no next found. So you can fade it out with CSS. Now this way there's no need to trim. $nav = ''; if($page->prev->id) $nav .= "<a href='{$page->prev->url}'>prev</a> | "; else $nav .= "<span class='inactive'>prev</span> | "; if($page->next->id) $nav .= "<a href='{$page->next->url}'>next</a>"; else $nav .= "<span class='inactive'>next</span>"; echo $nav;1 point
-
1 point
-
Three times I started to post my comments after the review but gave up. If you can describe PW API as only "decent" then you clearly haven't used the system! Anyway, could be a matter of language. Wanted also to comment on the issue of pages which we know is an abstract term. Also, wanted to say you can save other stuff in db if you don't care about urls. In addition, there are PW projects that have >100k pages! It's not just for small projects. Was tickled by "updating PW requires tinkering with the system" . Anyway, I'm now preaching to the choir . You are right though; the exposure's good. There have been many re-tweets about the post.1 point
-
I've pushed an update that fixes this issue: https://github.com/ryancramerdesign/ProcessWire/commit/9e1f46d3d1c69bebbd0415f58baad627a0d194d2 It was also a fairly simple matter to make it identify the language from the URL, when present. So I added that too. Meaning, if something about the URL points to a language (like /it/ at the beginning, for example) then it'll deliver the 404 in Italian rather than the default language.1 point
-
Nik, Thanks for the update. Feature request please: An option to "after save, edit next sibling" (an implementation of $page->next). Thanks.1 point
-
This case study relates to the topic here: http://processwire.c...ndpost__p__8988 about creating an archive of 'stories' about how PW has helped in relevant real life scenarios. Website: http://www.ray-dale.com RayDale Multimedia Ray Dale is a multimedia designer. His portfolio website was 2 years old as of March 2012 and in need of a refresh. He found that the content management for his website was more time consuming than he wanted and the website was generally slow in performance and complex to update. Ray needed: A website that could showcase his latest work with separate portfolio content types The ability to show lots of images and videos in each section Complex interlinking between each portfolio item - where each item would belong to a number of simultaneous categories To be able to publish a number of pages under various sections on the website To have a condensed navigation structure - not over-facing the user with navigation A blogging space that was easy to update To gain complete control over the HTML, CSS & JS markup and therefore the design of the website The ability to take more control over the admin experience - without using a host of plugins - so that the CMS could be used for clients to make their lives easier Speedy performance - even if a shared hosting platform were used Good site security The previous solutions Ray was previously using Drupal as a content management system. Drupal is a great system, it’s incredibly flexible, it can be made faster and using template overrides, almost complete control can be taken of the HTML and CSS output. However, the process to achieve any of this is time consuming and clunky from a web designer / front end developer perspective. Drupal was also going to require a number of plugins to be installed to achieve a lot of the required functionality. Ray tested migrating his website over to WordPress. WordPress is another fantastic blogging system with light CMS functionalities. WordPress is generally easier to use than Drupal and a lot of control over the HTML & CSS markup can be delivered - in a much easier manner than Drupal. However, WordPress is still light on CMS features in the admin system. This means that it is difficult without either using a lot of plugins or custom php development (using the WordPress API) to have custom content types and fields. The decision to use ProcessWire Having searched around for an alternative to Drupal and WordPress - revisiting other CMSs that Ray had also previously used - Ray eventually landed on ProcessWire having read about it on a forum. Right from watching the initial video produced by Ryan Cramer (the creator of ProcessWire) Ray was intrigued by the possibilities that ProcessWire seemed to offer - effectively solving all of the issues currently faced. To summarise ProcessWire offered: Custom content types in the admin Custom field types in the admin Good control over media uploads A simple to use admin system A neat and simple API for custom frontend / backend development A customisable admin experience The ability to have a custom admin url Complete control over HTML markup Good security with flood control A powerful and flexible templating system (that was also simple) Ray was extremely impressed by the features that ProcessWire offered, however, many CMSs look great until you actually start using them - where the unnecessary complexities, weak architecture and terrible, bloated functionality often start to appear. The functionality seemed so promising that a gamble was taken to build the Ray Dale Multimedia website - with very little time now available - to ProcessWire and test how it performed. Building the website Having built the original Ray Dale Multimedia website in Drupal, then converted to WordPress before deciding to gamble on ProcessWire - Ray now had very little time left to build his portfolio website. As a testament to the ease and speed of using ProcessWire - he was able (with a little help from articles in the forum) to rebuild the Ray Dale Multimedia website in two days of effective full time development. This included all of the content creation and learning the new system - with the inevitable (but surprisingly smooth) learning curve. Enabling complete control over output ProcessWire allowed Ray to write HTML and CSS without any of the interference you get from other CMS systems. So, Ray was able to use the following frameworks of his choosing: HTML5 boilerplate jQuery Modernizr Masonry A customised version of the 960 fluid grid system PrettyPhoto for lightbox images Less - to create minified CSS Though it must be said that literally anything can be used as ProcessWire makes no assumptions on the frontend - even on the Javascript framework. Quick and easy API One really pleasant surprise was the jQuery influenced API that ProcessWire offered. For example you can use php queries such as: $pages->find("selector"); $pages->get("selector, path or ID"); to find content in the system - you can even filter your queries by template type, fields attached to that item, etc. You can even use a range of selector operators. The API effectively works as a super powered and infinitely more flexible alternative to the WordPress loop. Cross referencing pages easily Complex cross-linking between portfolio items was needed so that capabilities, technologies and services could be linked to each item. It was easy to create a taxonomy system that worked the exact way required once the fundamental concept of how pages work in ProcessWire was understood. Building navigation that works Unlike a lot of CMSs that work effectively as ‘bucket systems’ - meaning that content is separate from any kind of structure or hierarchy by default in the system - whereas everything in ProcessWire is a page and arranged hierarchically. Whilst this may seem strange and restrictive to some used to the aforementioned ‘bucket systems’ - it works incredibly well and enables you to build navigational structures that are easy to plot a current location in. It is also something easy enough to break away from if you want a more ‘bucket’ type system. For example, in Drupal and WordPress it can be very difficult to highlight the navigation on a website if you are using custom content types. Try using custom post types in WordPress and keeping your navigation tracking which page the user has landed on - it’s extremely difficult without a fair bit of custom development (this is true as of the time of writing - WordPress 3.3.1). Because ProcessWire uses a structure and hierarchy by default - this structure makes building navigation that can track the current page very simple. Easy / flexible admin system The admin system in ProcessWire was easy and fluid to use, logical and stable. The admin system can also be overridden with templates (there are already some great community contributed templates). Modules used Whilst ProcessWire has a number of contributed modules from a thriving and helpful community - absolutely no additional modules were needed. All functionality on the website was achieved from a vanilla version of ProcessWire. Performance Another area of importance was the performance of ProcessWire. Again, Ray found this aspect to be well covered with built in caching capabilities that were thoughtfully included ‘out of the box’. The caching was simple to enable on templates and fields. The memory footprint of the Ray Dale Multimedia website was a third of that of Drupal on the same website without using addon caching plugins. Challenges The only real challenge faced was understanding that ‘pages are everything’ in ProcessWire. You build categories, taxonomy, articles, blog systems with the ‘page’ (and any fields it contains) being the basic building block for all of this. ‘Pages’ in ProcessWire can be attached to templates and injected with fields to enable the creation of literally anything conceivable. However, understanding this concept takes a little work for people used to other CMSs such as Drupal, WordPress and Joomla. However, in context - and compared to other systems - this learning curve is still fairly easy. There are so many other time savers that this learning curve becomes negligible. The other area that Ray had to understand about ProcessWire was that there aren’t any template system paradigms that exist in Drupal and WordPress. Other systems have parent and child templating systems with default parent templates that can be leveraged, however, because ProcessWire makes no assumptions on how you are going to build a project (being a true framework) you currently need to create your own template files. This is made easy by good documentation on the ProcessWire website and a decent set of ‘starter’ template files that come as part of the default install. Conclusion ProcessWire was an absolute dream to work with. Ray found it to be very stable, well thought out and hugely flexible. So much so in fact, that Ray has decided to standardise on using ProcessWire for upcoming web design projects. The flexibility and simplicity of the admin system, combined with power in frontend development that ProcessWire provides is something that Ray found to be liberating and more importantly ‘best in its class’.1 point
-
1 point
-
Meat and eat? No veggies allowed in Switzerland?1 point