Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/06/2015 in all areas

  1. I have a free account and only 10 shares allowed, but... I think I will migrate the project to GitHub tonight and just open-source it. I will post when it's done.
    3 points
  2. What is of() Baby don't hurt me Don't hurt me no more can't stop singing
    3 points
  3. Thanks adrian. One follow-up question. Why is this necessary? When searching for 'of(', '->of', etc., no results are found. In fact, the cheatsheet search renames my search to '- of' (greater than is replaced with a space). I don't know what software is used to present the docs, so I don't know how difficult it would be to add an 'un-filtered' search option. Can the references be 'upgraded' to include the 'why'? In the technical docs I've written in the past, I always included the 'what' (what it is), the 'how' (how its used, as in examples), and 'why' (why its used). Currently, the references only provide the 'what', with the ocassional 'how' in response to a specific question. I'm not knocking the docs. As a beginner with PW, the additional information would answer almost all of my noob questions. On a related note, PW has quite a few people that contribute to it's functional development, and it's support here in the forums. I don't have the internal PW knowledge to make those contributions, ...yet. The only skill set I posses at this juncture is assisting in ehancing the docs. I'll be glad to volunteer to extend the reference materials, if that is something y'all have had on the drawing-board. </ thinkingoutloud> Thanks again adrian.
    2 points
  4. I highly recommend reading the second post, too before implementing anything, as it might simplify a lot, depending on your setup.. Because I just updated all MarkupCaches with newer WireCache, couple of weeks ago, and really like it, I thought why not share it. So I got _init.php as prependTemplateFile, and _out.php as appendTemplateFile. But let's check out the interesting part, for example an article.php template. but for some pages, for example blog, it makes sense to include all children ;-) You can include any page you like, or define a time or a template as expiration rule. Here my defaults from the _init.php $cacheNamespace = "hg"; $cacheTitle = "$page->template-" . $sanitizer->pageName($page->getLanguageValue($en, "title")) . "-$page->id-{$user->language->name}"; $cacheTitle .= $pageNum ? "-$pageNum": ''; $cacheExpire = $page; I'm not exactly sure if there is any benefit in using a namespace, you can omit the namespace part and if needed just prefix the cache title. Works both. You'll see why I added the namespace/prefix a little later ;-) For the title I'm getting, the template, english page title (you can of course use the language title and omit the language name part, but I liked it better to have the caches grouped.. After language name I'm adding the page number if present. If you need you can of course create a different, more or less specific cache title. Add get parameters or url segments for example. Then I have $cacheExpire already set to $page as default value, so I don't need to set it in every template So my markup (only the important parts) looks like this: //You can have anything you like or need uncached above this $cacheExpire = $page->chilren(); $cacheExpire->add($page); $cache->getFor($cacheNamespace, $cacheTitle, "id=$cacheExpire", function($pages, $page, $users, $user) use($headline) { // as you can see, within the function() brackets we can pass any Processwire variable we need within our cached output. // If you don't need any you can of course leave the brackets empty // and if you need any other variable wich you had to define outside this function you can pass them via use() // so here goes all your markup you want to have cached // for example huge lists, or whatever }); // Then I have some more uncached parts, a subscription form for example. // After this comes another cached part, which gets -pagination appended to the title. Otherwise it would override the previous one. // It's not only caching the pagination, I just needed a name for differentiation. $cache->getFor($cacheNamespace, $cacheTitle.'-pagination', "id=$cacheExpire", function($pages, $page, $users, $user) use($headline) { // so here comes more cached stuff }); After this your template could end or you can have more uncached and cached parts, just remember to append something to the cache title ;-) Now comes, at least for me, the fun part haha In my prepended _init.php template file I have the following code under the cache vars: if($user->isSuperuser() && $input->get->cache == 'del') { if($input->get->clearAllCaches == "true") { $allCaches = $cache->get("hg__*"); foreach($allCaches as $k => $v) $cache->delete($k); $session->alert .= "<div class='alert alert-success closable expire'>All (".count($allCaches).") caches have been deleted. <i class='fa fa-close'></i></div>"; } else { $currentPageCaches = $cache->get("hg__$page->template-" . $sanitizer->pageName($page->getLanguageValue($en, "title")) . "-$page->id*"); foreach($currentPageCaches as $k => $v) { $cache->delete($k); $session->alert .= "<div class='alert alert-success closable expire'>Cache: $k has been deleted. <i class='fa fa-close'></i></div>"; } } $session->redirect($page->url); } So when I append the parameter "?cache=del" to any URL all cache files within my namespace and beginning with the predefined $cacheTitle will be removed. Means all language variations and the "-pagination & -comments" caches will be deleted, too. This is the else part. But if I append "&clearAllCaches=true", to the first parameter, it will get all caches within my namespace and clear them. Without the namespace it would clear Processwires caches (like the module cache), too. I'm storing a little success message in a session called "alert" which is closable by the FontAwesome icon via jQuery and expires after some seconds, means it will remove itself, so I don't have to click ;-) Maybe it makes more sense to change the cache title and have the page->id first, so you could select all related caches with $cache->get("hg__{$page->id}*"); I liked them grouped by template in the database, but maybe I change my mind soon because of this For not having to type those params manually I have two buttons in my _out.php template file. I have a little, fixed to the left bottom corner admin menu with buttons for backend, edit (current page), and now clear cache button which unveils the clear all caches button on hover, so it's harder to click it by mistake. When someone writes a comment, I added similar lines as above, after saving the comment, to clear comment caches. Ah, the comment caches look like "-pagination" just with "-comments" appended instead. I don't know if there is an easy way to expire a cache when a new children (especially backend created) is created, other than building a little hook module. With MarkupCache it could be a pain to delete all those folders and files in /assets/ folder, especially with slow connection. The database driven WireCache makes it much faster, and easier when set up those few lines of code to make it for you. more about WireCache http://processwire.com/blog/posts/processwire-core-updates-2.5.28/#wirecache-upgrades https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/core/WireCache.php Hope it helps someone and is okay for Tutorial section, if you have any questions, suggestions or ideas feel free to share. Hasta luego Can
    1 point
  5. Just wanted to share a simple bash script I've been using lately to make installing ProcessWire a little faster. Feel free to modify it to your taste! Just copy everything into a simple text file, I call mine "preparepw". Optionally, set this file to executable (chmod -x preparepw) and put it somewhere into your path to be able to load it as a regular command without the need to call it from sh ~/preparepw for example. To run, first cd to where you want to install PW's root, e.g. /sites/mysite/ then call the script. It will create a /sites/mysite/wwwroot/ directory containing all of PW's files from current master, set the required permissions and rename htaccess. It has an option to set the directory that, when unset, will default back to ./wwwroot. (e.g. preparepw public would install PW in ./public/). #!/bin/bash # Version 2.0 INPUT=$1 if [[ -z $INPUT ]]; then INPUT="wwwroot" printf "Directory option not set, installing into ./$INPUT/...\n" else printf "Installing in to ./$INPUT/...\n" fi # Select a version printf "\nWhich ProcessWire branch do you want to install?\n" options=("master" "dev" "devns") select BRANCH in "${options[@]}"; do test -n "$BRANCH" && break; echo ">>> Invalid selection, please try again"; done printf "\nDownloading ProcessWire $BRANCH branch, please hold on...\n" # Get ProcessWire master and prepare files if [ "$BRANCH" == "master" ]; then curl -o processwire.zip https://github.com/ryancramerdesign/ProcessWire/archive/master.zip -# -L fi if [ "$BRANCH" == "dev" ]; then curl -o processwire.zip https://github.com/ryancramerdesign/ProcessWire/archive/dev.zip -# -L fi if [ "$BRANCH" == "devns" ]; then curl -o processwire.zip https://github.com/ryancramerdesign/ProcessWire/archive/devns.zip -# -L fi unzip -q processwire.zip rm processwire.zip if [ "$BRANCH" == "master" ]; then mv ProcessWire-master $INPUT fi if [ "$BRANCH" == "dev" ]; then mv ProcessWire-dev $INPUT fi if [ "$BRANCH" == "devns" ]; then mv ProcessWire-devns $INPUT fi chmod -R u+rwX,go+rX,go-w $INPUT mv $INPUT/htaccess.txt $INPUT/.htaccess cd $INPUT # Prompt for site profile printf "\nWhich site profile will you be using?\n" select d in site-*/; do test -n "$d" && break; echo ">>> Invalid selection, please try again"; done mv $d site/ rm -rf site-*/ # Set permissions chmod 777 site/assets chmod 777 site/modules chmod 666 site/config.php printf "\n" read -p "Press [Enter] once you've finished the installation process to remove the install files..." rm install.php rm -rf site/install printf "\nInstallation files removed.\n" printf "\nDirectory \"$INPUT\" all set for ProcessWire. Have fun! \n"
    1 point
  6. Because I wanted to be able to strip all line breaks from a textarea field and then apply the Thinspace textformatter, I forked Netcarver’s module, added the required line and simply called it “Thinspace Plus” (which is not very creative, I know): https://github.com/MichaelvanLaar/PW-TextformatterThinspacePlus I use this Textformatter mostly for textarea fields that contain meta descriptions and similar content. The reason I use textarea fields here – instead of simple Text fields – is that I want to be able to use the great Textarea Counter module with these fields. But since these fields are intended to be simple strings without any line break or paragraph formatting, I want to “flatten” them – just in case an editor enters a line break. OK, the line breaks probably won’t do any harm in meta descriptions, OpenGraph descriptions, etc. But I just want to see them in my rendered source code ;-)
    1 point
  7. Hi Guys, Here's another website from us. It is some months old, but I was waiting for all the content to be in place before showing. http://davinci-porto.pt/ This is a frames workshop and art gallery in the main art neighbourhood from Porto. the content is in Portuguese, sorry Exceptionally in this site, there was no intervention from Erika, so the design is mine.
    1 point
  8. Quickly toggle your checkboxes with extra action buttons via AJAX. The module adds functionality to InputfieldCheckbox so you can toggle the checkbox fields in the extra action buttons intruduced in ProcessWire 2.6.5 via AJAX. Github Page Download Link Requirements This module works only for ProcessWire versions later than 2.6.5. How to Install 1. Copy the files to /site/modules/ProcessQuickToggle/ 2. In your admin, go to Modules > Refresh for new modules. 3. Click the "Install" button next to "Process Quick Toggle". Usage Go to any checkbox field you want to enable quick toggle feature for. Setup > Fields > my_checkbox_field. There in the Input tab you should see an Enable Quick Toggle field. After you check it you will see some fields that you can fill based on your needs. Then save the field. Now there should be an extra button for every page that has this field in the Pages tree. Features Supports template contexts. Supports core FontAwesome icons. Any kind of feedback is appreciated.
    1 point
  9. The source is on GitHub, knock yourself out https://github.com/mindplay-dk/SystemMigrations
    1 point
  10. Y'all might want to grab your sun-glasses. That extra illumination y'all see in here, it's from the light that just came on. Thanks thetuningspoon.
    1 point
  11. https://processwire.com/talk/topic/10485-simplify-output-formatting-when-saving-pages-via-the-api/
    1 point
  12. Well, it's a web service. You can use JSON. Or some server driven mechanism, like curl and some php. It's the only external interface to ProcessWire as far as I know. Since you can't simply include ProcessWire in Typo3, I think it's the route to take...
    1 point
  13. Hi Juergen, Finally track down the problem. The button is there but it is invisible if you choose any of those colour profile. Gideon
    1 point
  14. Yep, 0,1,2,3 has nothing to do with the frame the image is taken from, they are just "names" for certain thumbnails. Here is a good thread detailing all the available images: http://stackoverflow.com/questions/2068344/how-do-i-get-a-youtube-video-thumbnail-from-the-youtube-api Actually on that note, I see that I am missing "sddefault", so I will add that now.
    1 point
  15. Wonderfully simple solution - thank you LostKobrakai! For anyone interested this was my final code - all working correctly: $list = $page->siblings("content_type!=6,sort=article_publish_date"); $prevPage = $list->getPrev($page); $nextPage = $list->getNext($page); if($prevPage) echo "<i class='icon-chevron-left'></i> <a href='{$prevPage->url}'>" . ${'previous_'.$countryCode} . "</a>"; if($nextPage) echo "<a href='{$nextPage->url}'>" . ${'next_'.$countryCode} . "</a> <i class='icon-chevron-right'></i>";
    1 point
  16. I am new to ProcessWire. I am not new, however, to programming (started with assembly back in the '70s). I'm not writing a marketing speel here -- I simply want you (the developers and community) to know how I arrived at ProcessWire as my solution. I have specific requirements for a numer of projects that I will be starting (hopefully) in the next few days, and had been researching various CMSs and frameworks the past few weeks to find a 'one-size-fits-all' toolbox. I have currently forty-four cms installs (from academic to zikula) and thirteen different frameworks ( from akelos to zoop). They all have their merits, and are fine solutions for many users and developers. ProcessWire is one of the original 44 installs, but at first 'glance' didn't seem to fit what I was looking for. Later, after searching the web for a solution to one particular issue, a link back to a PW solution emerged. I clicked the link, and low and behold, ProcessWire *was* what I had been searching for all this time. On a related note, google has sent me a nasty-gram about the reactor they had to fire up because of my queries. The primary strength of ProcessWire that I have discovered so far, is that I (as a developer) am not limited in the tools I can use, or the tools I can create. ProcessWire is sleek and efficient. It is a toolbox full of tools that allow me to build a fine watch, a multi-story office complex, or a fishing pole. The other applications suffer from either bloatware or limited tool availability, or worse, both. I could very well accomplish my project goals using any of these other applications but with much head-banging, hair-pulling, and cosumption of scotch. The biggest 'selling' factor to me for ProcessWire, however, was it's efficient engieering in the construction of built-in tools I will require now, and the ability to create my own tools for use in the future.
    1 point
  17. When using the Search feature (masthead) I can't highlight found items using up and down arrows. I think it would be a nice helper feature as clicking on an item is much harder. (and after typing your hands are on the keyboard, not on the mouse)
    1 point
  18. u uses title 2 time like.this title%=red, title%=crap If.u no want crap buts do.want reddish crapapples do this title%=red, title%=crap, !title~=crap
    1 point
  19. Hi Guys, I don't know whether this topic is already discussed or not. I was wondering whether PW already have thought of having an inline editing tool. What am I talking can be seen from demo http://demo.createphp.org/ http://createjs.org/ https://github.com/flack/createphp
    1 point
×
×
  • Create New...