Leaderboard
Popular Content
Showing content with the highest reputation on 05/20/2013 in all areas
-
Today I want to present my personal website with a new design and my tumblr posts (in "Blog" section) directly imported into ProcessWire: Nico.is What do you think?6 points
-
Local Audio Files - MP3-DB The Local Audio Files DB is a combination of a Module and a SiteProfile. It is intended to import MP3-files from your filesystem into ProcessWire, read ID3-Tags and pull coverImages from it to feed the DB. It is thought as a starting point for your own site creation. A sort of comfortable aggregated reuseable code for PW-lovers. How to Install Grab a copy of the latest ProcessWire. Replace the install, modules and templates directories with those in this profile, as shown below: /site-default/install/ /site-default/modules/ /site-default/templates/ With SiteProfile-Installs normally that is all there is to do. With this Profile you also have to copy the file LocalAudioFilesImportShellScript.php (for simplicity) to your PW-rootfolder, (where the index.php reside). If you are on Windows you also should copy mp3_import_starter4win.cmd to the same location. Now install ProcessWire as per the instructions included with it and it will install the LocalAudioFiles profile automatically. After that you find a Quickstart Guide at the homepage of the profile: Follow the 3 steps and you are done! How does it work? The Site has 4 sibling Tree Branches: genres - artists - albums - songs. Each of them hold child-pages: genre - artist - album - song. The logical relations are nested parent-children ones: a genre hold artists, each artist hold albums, each album hold songs. To support both, slim and fast data relations & the logical hirarchy, the module extends the ProcessWire variable $page with some additions. It uses the addHookProperty mechanism to achieve that. It uses an own caching mechanism for large lists, that can be prebuild when running the importer-shellscript, or it build the cache on demand. Also it comes with a FrontEndHandler class that provides a lot of functionality, for example fully customizable FormSelectFields of all genres, artists or albums. More detailed informations and code examples are collected in a demo section of the site. The extended $page variable together with the LocalAudioFiles-FrontEndHandler gives you comprehensive tools to work with your music collection. Download Modules Directory LocalAudioFiles-SiteProfile_v0.1.5.zip LiveDemo I have uploaded a small LiveDemo with only 7 truncated songs. But it's pretty fine to view all Demos and the additional $page->proterties. demo song page demo album page demo artist page demo genre page Graphical overview Screencast of installation https://youtu.be/-qYyppvEF1k History of origins http://processwire.com/talk/topic/3322-how-to-setup-relations-for-a-mp3-db-with-pw/ http://processwire.com/talk/topic/3462-pages-get-return-nullpage-but-page-exists/5 points
-
Module: TemplateHasTags Simple Module that provides a method for checking if the current template has got (or has not got) one or more specific template tags. Wanted to control the visibility for some blocks on the frontend in the backend without modifying the code. This seemed to be the best way. Returns true if the currently used template: -- has the tag "detail" but not "special" $page->hasTags("detail !special"); -- does not have the tag "listview" $page->hasTags("!listview"); You can also use $page->hasTag("lorem ipsum"); Module link4 points
-
3 points
-
Micha, Thanks for this module. For reference for all reading this, these "tags" have been discussed previously in this thread: http://processwire.com/talk/topic/2689-possible-to-get-field-tags/. See Ryan's thoughts on post #21.2 points
-
ProcessWire Online Installer Since there's now a shortcut to download latest stable PW http://grab.pw , I created a simple helper PHP script you can upload to your server to download and extract a new PW installation. Upload this php file to the server where you want to install latest ProcessWire Go to the browser and call this script. It will download and extract ProcessWire files. Once done successfully it will redirect to the installer. Downloaded zip the grabpw.php will be removed. If anything fails, make sure permission are correct on server and you remove files manually in case. I tested this on my local XAMPP (Mac) install and on some of my account on a ISP. Also I took some methods to download and extract files from my ModulesManager which seems to be "reliable" so far. Download The script can be found on github: https://github.com/somatonic/PWOnlineInstaller Why Just because it's cool. There's many ways to accomplish this task if you have ssh access for example using shell. Just wanted to have this alternative and maybe people find this useful too. @ryan. Do you think you could provide an latest dev shortcut url too?1 point
-
1 point
-
Love it! Obviously as you made it I love the modern feel and type and the humour and quality touches that you've applied. I also quite like the minimalist "contact" page There's a few image links down but guess you're working on them. Great work Nico, comme d'hab.1 point
-
I had the same once with woopra, I was seeing the stats of one guy, and he was seeing my stats. We told them, and they corrected.1 point
-
Hi Peter, Set your pages to 'hidden'. This way they won't show up in searches unless you add include=hidden into your selector. Do your data pages have a template file associated or just hold data? If there's no template file, then the pages are not accessible in the frontend anyway because Pw will throw a Wire404Exception (page not found). If the data pages have a template file, then you could check on top of that if the user is SuperUser or has a certain role: // In your template file if (!$user->isSuperUser()) { throw new Wire404Exception(); } // OR if (!$user->hasRole('superAdmin')) //...1 point
-
Hi andy, welcome to Pw I don't understand what you want to do, can you post some example code? It depends where you are calling $input->urlSegment1. If this is on a template with urlSegments enabled and returns nothing, then there is no urlSegment available. To get the url of the actual page viewing, use: $page->url; CHeers1 point
-
You're welcome. Here's a good overview how Hook works: http://processwire.com/api/hooks/ Also checkout the captain which shows you all the hooks available: http://somatonic.github.io/Captain-Hook/ And here an example, written in the browser and not tested: // Inside your autoload module you have installed... public function init() { $this->addHookAfter('ProcessPageEdit::buildForm', $this, 'hideFields'); } public function hideFields(HookEvent $event) { // Do nothing if we don't edit a user if ($this->page->template != 'user') return; // Get the form instance returned from the hooked method $form = $event->return; // Define fields to hide per role $hideFields = array( 'role1' => array('field1', 'field40'), 'role2' => array('field5', 'field2'), ); // Hide the fields foreach ($hideFields as $role => $fields) { if ($this->user->hasRole($role)) { foreach ($fields as $field) { $f = $form->get($field); $f->collapsed = Inputfield::collapsedHidden; } } } $event->return = $form; }1 point
-
The editor is very well done, I'm not trying to bring it down or something. Be aware that I'm talking of a very particular scenario here, where I want all the pictures from a page to go into the editor. Usually I would prefer to just use the images on the template directly from the image fields. So, in this particular scenario, it "feels stupid" to put them one by one in the editor, when it was so easy to drop them in the field. Apeisa, I'm not only talking about the grid on that window. I talking about the editor itself, In this case I want the images to be big on the frontend, but then, I have 10 images 800px wide on the small CKEditor box, and have to put text in between them. In my case, I don't care to see how the image will look like with the text, I just need the reference of them, so a thumbnail would be enough. (again, very particular scenario). -- EDIT: ok, this last problem was pretty easy to solve. In the CKEditor field I just had to define a custom css with this content: img{ max-width:200px; } Great1 point
-
... and assuming that you don't / can't add all image field names in your code, something like this should also work: $allImages = array(); foreach ($fields->find("type=FieldtypeImage") as $f) { foreach ($pages->find("$f.count>0") as $p) { foreach ($p->$f as $i) $allImages[] = $i; } }1 point
-
// assuming your images field is named "images": $pagesWithImages = $pages->find("images.count>0"); // now that you have all pages with images, you can put them all in 1 array if you want $allImages = array(); foreach($pagesWithImages as $p) { foreach($p->images as $image) $allImages[] = $image; }1 point
-
1 point
-
I think this method will work even if you expand it out. I changed a few things up, but hopefully it makes sense. Product pages use "template product", all other catalog pages use "template catalog". Catalogue -- Men ---- Shoes ------ Product 1 ------ Product 2 ---- Hats ------ Product 1 ------ Product 2 -- Women ---- Shoes ------ Product 1 ------ Product 2 ---- Hats ------ Product 1 ------ Product 2 Categories (these pages only a template with a title field) -- Brands ---- Brand 1 (title only template) ---- Brand 2 (title only template) -- Type ---- Type A (title only template) ---- Type B (title only template) -- Collections ---- Collection A (title only template) ---- Collection B (title only template) catalogue.php template & product.php template (same contents) <?php /* There might be a better way to accomplish this. The only reason to have 2 templates is to give find() a way * to only return the actual product pages, and not all the parent pages as well. * * update: You may want to look into using the alternative template method: * * * With this approach you would create a real file (product.php) for the product template, * catalogue template would have no file associated, but point to product.php under the advanced settings tab. */ include("./site/templates/head.inc"); include("./site/templates/product-view.inc"); include("./site/templates/foot.inc"); product-view.inc <?php $brand = ""; $type = ""; $collection = ""; if ($input->urlSegment1) $brand = ",brand.name=".$input->urlSegment1; if ($input->urlSegment2) $type = ",type.name=".$input->urlSegment2; if ($input->urlSegment3) $collection = ",collection.name=".$input->urlSegment3; if ($input->urlSegment4) { // if Segment 4, then we know what page to get $product = $pages->get("name=$input->urlSegment4"); echo $product->title; } else if ($input->urlSegment1){ // check if we are using URL segments if ($input->urlSegment1 == "all"){ $products = $pages->find("has_parent=$input->urlSegment2, template=product"); } else { $products = $pages->find("has_parent=$page->path, template=product, . $brand . $type . $collection"); } foreach ($products as $p){ echo $p->title; } } else { $products = $pages->find("has_parent=$page->path, template=product"); foreach ($products as $p){ echo $p->title; } } Looking at example URLS to see how the selector would get populated: /catalogue/brand1/ Brand1 is a url->segment1 so the elseif evaluates to true, and the selector gets populated to become: $products = $pages->find("parent=/catalogue/, template=product, brand.name=brand1"); /catalogue/brand1/casual/ elseif evaluates to true, and the selector gets populated to become: $products = $pages->find("parent=/catalogue/, template=product, brand.name=brand1, type.name=casual"); /catalogue/brand1/casual/trendy/ $products = $pages->find("parent=/catalogue/, template=product, brand.name=brand1, type.name=casual, collection.name=trendy"); /catalogue/men/ $products = $pages->find("has_parent=men, template=product"); /catalogue/all/shoes/ $products = $pages->find("has_parent=shoes, template=product"); /catalogue/all/hats/ $products = $pages->find("has_parent=hats, template=product"); /catalogue/men/shoes/ no URL segment here, so the if/elseif are false, so we get: $products = $pages->find("has_parent=/catalogue/men/shoes/, template=product"); /catalogue/men/shoes/brand1/ Brand1 is a url->segment1 so the elseif evaluates to true, and the selector gets populated to become: $products = $pages->find("parent=/catalogue/men/shoes/, template=product, brand.name=brand1"); you get the idea. Again, untested and coded in the browser — but hopefully thought out enough to get you started.1 point
-
Looks like a good creative use of tags there. I hadn't planned on them being used that way, but it seems like a good use case. It makes me think I should add a hasTag() function or something, so you wouldn't have to do something like a strstr() and would instead have reliable word boundaries between tags.1 point
-
Probably best way to use some custom tag like #PAGEBREAK# and then use some logic and urlSegments to split those into different pages. But usually I would try to avoid multipage articles. Only reason those exists are that sites running ads want to maximize their page views.1 point
-
I can only applaud PW is a great little CMS, and your logical and reasoning seem to be just right in every part of it.1 point