Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/26/2013 in all areas

  1. Hi all, here it is the site we made for an european project with processwire! http://smartenergyproject.eu The project will continue for 2 years, and maybe will have 3 languages (EN, ITA, DEU), many editors, and maybe a linkedin integration so is a good start point to test all features of processwire! Alessio
    6 points
  2. I just found why grid sorting doesn't work. It's because Ryan added a axis: 'y' to the sortable init to restrict it to vertical sorting.... If I remove that it works with the sorting. This is what I have added to the inputfields.css of the admin theme. ul.InputfieldFileList{ overflow: hidden; } ul.InputfieldFileList li{ width: 32%; margin-right: 1%!important; float: left;} And this added to the inputfields.js of the admin theme $( ".InputfieldFileList" ).sortable( "option", "axis", "" ); So it does work again. Edit: Ok it does not work to set the option afterwards. I had removed the option in the core so it worked and forgot. Looks like it would have to changed in the InputfieldFile.js in the core to remove the axis: 'y'; Just to note that this might look nice, but since the height of a box isn't fix, once you have a image that has a long title the box will get taller and the floating will get screwed. So you would have to give the li a fixed height. Edit: or to avoid long image names to break one could add this ul.InputfieldFileList li .InputfieldFileName{ width: 150px; display: block; overflow: hidden; white-space: nowrap; float: left; margin-right: 1em;}
    3 points
  3. in addition to pwired here http://processwire.com/talk/topic/3785-alternative-syntax-for-control-structures-a-tip-for-newbies/#entry37007 http://processwire.com/talk/topic/3691-tutorial-a-quick-guide-to-processwire-for-those-transitioning-from-modx/?view=findpost&p=35953 http://processwire.com/talk/topic/3754-proof-of-concept-processwire-admin-theme-switcher/?view=findpost&p=36621 http://processwire.com/talk/topic/3785-alternative-syntax-for-control-structures-a-tip-for-newbies/?view=findpost&p=36950
    2 points
  4. The error reveals that get() is called on a non existent object. In the example the $fields->get(), see? Means the $fields somehow doesn't exist... it can't call the member method get() on it. $fields is like $pages or $page available in all template files, if not, there something either wrong with your installation, or you're using $fields in a function or module. In the scope of a function you'd have to use the global function wire("fields")->get(). $page in the getInputField($page, null) is just a page and I think it can be any, PW requires it. The secon argument is for the context. Since fields can have template context settings, you could pass the template there I think. You can see the base classes wire/core/field.php and wire/core/inputfield.php or any wire/modules/Fieldtype/* and wire/modules/Inputfield/* module that extend those. But the more important part in the code is this: $f->attr("value",$page->somefield); Where you set the value of a page to the inputfield before rendering. This is a very broad, somewhat complex or versatile, advanced and individual topic, I always have a little hard time educate to someone with basic to none coding skills just through writing without knowing the whole scope of the project and context. Are those front end users, trusted or not. What data needs to be edited or created... uploads, datepickers or just simple selects and so on. I spent already sooo many hours coming up with examples and explanations that I hardly feel motivated to do it over and over again. No offense to you or anyone personally of course! Peace The thing is, it is an somewhat advanced topic and it also took me some time to find all out and learn by trying and reading source code in core, understand how it works and what are the limits. It's also good to know that the inputfields and fields used in the backend primary are built to be used in the admin context and not originally intended for front-end usage. But it's built so well by Ryan that it's possible to use them out of the admin context to some extend. It's just that some fields other than simple text, select, radio or checkboxes ... like files, images,ASM select, dates with datepicker, they require some more assets to also be included in your front-end namely js and css files. So you'd have to include them aswell. The admin theme templates uses the $config->scripts and $config->styles file arrays to render the styles and scripts loaded by a inputfield module. I also recommend: - Read that thread I linked to completely. Have a look at some examples (my gists with forms) to get a feeling. They're by no mean complete or the only way. It gives you enough flexiblity even with styling and markup. You can set the markup of InputfieldWrappers. ie. $form->setMarkup($options) you'll see in wire/core/InptfieldWrapper.php - Study the FormTemplateProcessor module by Ryan. http://modules.processwire.com/modules/form-template-processor/ As Matthew said, you can also just build your very own markup and forms, as you would normally and use the API to add values, validate and save values to pages. It's not that much of a magic. And maybe keep trying to make simple forms using the API first to get into it... you know start small, grow big. Try to learn from mistakes and experiments asking in the forums.
    2 points
  5. Ok think I got a way to change the axis on sortable. Problem was that PW only inits the sortable for list greater than 1. So I got an error with the script that it can't set the "option" prior to initialisation. I made it work with: $sortableLists = $(".InputfieldFileList"); $sortableLists.each(function(){ if($(this).children('li').size() > 1) { $(this).sortable( "option", "axis", "none"); } });
    2 points
  6. Maybe you can recover your avatar from the MODX forums
    2 points
  7. ProcessWire2.+ Minify 1.0.3 This module helps you combine Javascript and CSS files into one, minified file to save on unnecessary HTTP requests and to compress files anywhere up to 80% (including already minified .js files). To use it, extract the attached zip file into your /site/modules/ directory and check for new modules in the ProcessWire Admin area, then install the module. Once installed, go to configure the module and, instead of this configuring anything for you, you can use the drop-down lists to build stylesheet and script code to place in your templates, grabbing a list of any stylesheets and scripts it finds in the /site/template/styles/ and /site/templates/scripts/ directories respectively. It's more of a helper than anything else, but it should take the guesswork out of configuring Minify for your site. Notes: This module contains a third-party library - Minify - which is subject to its own license (a copy is included in the attached zip file). I've left the module in-tact including its unit test files so there are more files than are necessary, but this will make it easier for me to upgrade the module if/when they release updates to that code. This module doesn't insert any code into your templates automatically - I think copying and pasting the code it currently outputs to the screen is more useful/configurable for more situations. It's worth using even if you only have one CSS or JS file as it will compress CSS files by about 80% and JS files by quite a lot too, plus since it handles caching on the server-side and does its own checks of the files it is serving (plus it's a dynamic URL), you can always be sure that it will serve the latest version of a CSS file (no more CTRL+F5 to show the new styles if your browser decides to cache it. You can change the /site/modules/Minify/min/config.php as you could if you were using Minify as a standalone script - tweak cache paths (default is your server's cache path) and other advanced settings here. Updates: v0.0.2 - now produces code that includes paths derived by ProcessWire at run-time so paths will be fine on localhost and live servers, removing potential issues when pushing a site live. v1.0.0 - bumped this up to a major version number since there appear to be no issues with the initial versions to speak of. Also implemented yellowled's input field suggestion (looks much better and easier to select for copy and paste purposes) and turned off autoload at ryan's suggestion. v1.0.1 - now recusrively searches for files inside subfolders under the scripts and styles directories using PHP 5's built-in iterator classes v1.0.2 - pull request from teppo - https://github.com/Notanotherdotcom/Minify/pull/1 v1.0.3 - updated Minify code to v2.1.7 which fixes a significant security flaw: https://groups.google.com/forum/#!msg/minify/cpN-ncKPFZE/kwYVpLMkfDwJ You can download the module here.
    1 point
  8. Hey, I needed a newsletter system for two websites I'm currently building. So I wrote a standalone ProcessWire newsletter system called: MarkupNewsletter The video below shows the workflow: https://vimeo.com/68954976 (it's still converting) Hope you like it! Please report any bugs or questions here. (I'll add it to the modules section after a short beta time). / Nico
    1 point
  9. Bellissima!! the main menu is a bit jumpy for me though
    1 point
  10. Ah now that's the numChildren problem. In that it isn't published or access aware. Means even if all children are unpublished it will return true. There's now a attribute to make it recognize that Not sure what version it was added exactly but maybe this works for you: change all $child->numChildren to $child->numChildren(true) Or if you use older version you can instead replace it with this: count($child->children)
    1 point
  11. I included the unframework Flourish once to validate forms and send emails. Since PW now has validation and required options for inputfields I don't need it anymore. I used codeigniter for some years long before PW but haven't since used it or any other framework as I'm very happy with PW.
    1 point
  12. You need an Avatar one of these days Kongondo! If I recall, WillyC made you a pretty awesome one awhile back. Though if you like the anonymous man one, maybe we can at least dress it up a bit (perhaps a hat, ears, gratuitous lens flares or something?)
    1 point
  13. Hey, I made a new website for a berlin-based "balkan electro dj". Check it out: http://balkantronika.de/ (and listen to the songs at the bottom )
    1 point
  14. Great site Nico. I'm assuming so that the images look sharp on high DPI displays (aka Retina displays). We do the same thing on processwire.com with several images where it counts, doubling the resolution and scaling down. Though not more than double. So a 960px to 240px would be more than necessary for any displays that I'm aware of.
    1 point
  15. Thanks. I never really knew about fieldset_open / fieldset_end. Stumbled over this forum thread also: http://processwire.com/talk/topic/665-editing-fieldsets/ It will surely come in handy at some point. Although I do save some space now, I still didn't find a way to actually be able to display image thumbnails next to each other (3 or 4 in a row). Is that somehow possible? e.g. I have two fieldsets: content 33% (everything else than images) + images 67%. But the thumbnails are still displayed one on each row. Is it not possible to change the CSS properties of the image input field? I tried editing .InputfieldImage in wire\modules\Inputfield\InputfieldImage\InputfieldImage.css with no luck
    1 point
  16. I think one of the harder questions here is how do you create a project proposal for a really huge site project along with a project 'budget'. I have been researching it and came across some interesting sites: http://redfoxwebdesign.com.au/blog/getting_your_website_designed/how_much_does_a_website_cost http://www.designquote.net/html/dq_estimate_wizard.cfm https://quoterobot.com/ http://www.pearsonified.com/2006/06/how_much_should_a_design_cost.php
    1 point
  17. No you dont have to upgrade anything just deinstall and install the other. Remove what you dont need like the published page field if you used that. Then you configure lang segment on home root page settings. And of course you have to enter all page names for the alternative languages. So if your site is already live you might want to copy the titles to the name fields which could be done with a simple script sitewide. And of course you have to adapt your language switch. Youll find more infos in the module thread.
    1 point
  18. You could add fieldsets to your templates, then let the content related stuff on the left and the storage & settings related stuff on the right side This way you could save some space. Template fields: fieldset_content (set to 60% width) title headline summary body fieldset_content_end fieldset_storage_settings (set to 40% width) images files amazing_checkbox etc... fieldset_storage_settings_end
    1 point
  19. Yep, this is great module. I also want to encourage people to write their own import scripts. It is simpler than you can believe and you can re-import easily.
    1 point
  20. I love you Soma Here's a more detailed example - again, this code needs to go in a Process module public function execute() { // This is our outer wrapper $outerWrapper = new InputfieldWrapper(); // This will be our first tab $tabOne = new InputfieldWrapper(); $tabOne->attr('title', 'Tab 1'); // I'm using InputfieldMarkup as I just want to output HTML - could be a form, some fields etc, but since I only just realised what InputfieldMarkup actually does (d'oh!) I'm going to use it lots! $markup = $this->modules->get('InputfieldMarkup'); $markup->attr('value', "And I'd have gotten away with it..."); // Append the markup to tab one $tabOne->append($markup); // Append this tab to the outer wrapper $outerWrapper->append($tabOne); // Here's another tab $tabTwo = new InputfieldWrapper(); $tabTwo->attr('title', 'Tab 2'); $markup = $this->modules->get('InputfieldMarkup'); $markup->attr('value', "...if it wasn't for those pesky kids!"); $tabTwo->append($markup); $outerWrapper->append($tabTwo); return "<div id='MyTabs'>" . $outerWrapper->render() . "</div>"; } And again, you need Soma's JS in your module's JS file: $(function(){ $t = $("#MyTabs"); $t.find("script").remove(); // to avoid double script execution $t.WireTabs({ items: $("#MyTabs > .Inputfields > .InputfieldWrapper"), id: 'ProcessExampleTabs' }); }); Lovely job
    1 point
  21. I tried the latest dev and had trouble (which I had not before) with certain serarches: 1. the admin search: clicking on the number-link at the headline of a template editing page (showing the pages that use that template) gave empty results; 2. Switching to Edit this page (from the silver admin bar) gave an empty search page instead of the page with the edit overlay.
    1 point
  22. i tried Pete's code but it wasn't working; i made some changes based on seeing similar things on other modules, so here is a version that is working for me on latest stable: <?php class BuildUrl extends WireData implements Module { /** * Basic information about module */ public static function getModuleInfo() { return array( 'title' => 'Build URL', 'summary' => 'Builds a URL on page save based on specific fields.', 'href' => '', 'version' => 001, 'permanent' => false, 'autoload' => true, 'singular' => true, ); } /** * Initialize the module and setup hooks */ public function init() { $this->pages->addHookAfter('saveReady', $this, 'buildUrl'); } /** * * @param HookEvent $event */ public function buildUrl($event) { // Accesses the $page object $page = $event->arguments[0]; if($page->template != 'product-child') return; $page->name = $page->title; $this->message("slug changed to " . $page->name); } }
    1 point
  23. Hi Thomas and welcome to PW! You should be able to do this with a very basic custom module. I think this code from Pete should be a good start for you: http://processwire.com/talk/topic/1648-ok-to-change-page-name-path-after-save/?p=15232
    1 point
  24. I'm sure you already know this, but still: Location can't be reliably identified based on IP alone. Even if you use a very large list of IP's connected to location data that some sites distribute, you'd still have to take into account various proxy services, possible human error etc. Essentially this kind of feature is OK for offering extra value for some users, but it's definitely not a good idea to rely on it alone to provide any security-related features. Just saying. But to get to your questions.. If you're going to have a lot of IP ranges (and you'll probably have if your list is even half comprehensive) this might be a very good idea. As a matter of fact, since you mentioned it here, I've started thinking that perhaps I should include something similar to the original module itself.. can't give an ETA for that yet though, and it might not even be of benefit in your case This is a tricky question. First of all, I'd suggest looking into Markup Cache -- it'll allow you to cache parts of your page, even if whole pages can't be easily cached. That's probably the easiest method here. Other option would be caching two versions, like you've pointed above, but as far as I know that's not really an option available out-of-the-box. Template Cache allows you to cache URL segments, so you might be able to work around this problem using that for an example. Could get very complicated very fast though. With commercial Pro Cache module you can bypass the cache when certain cookie is set.. though it might be difficult to set that cookie if pages keep getting served from cache. That could be an option if you're relying on some pages not being cached, ie. users always entering via root page which won't be cached at all. Doesn't sound like a good idea, but I don't really know your whole setup, requirements and plan here either, just throwing in ideas Edit: as a matter of fact, you could probably also use modified Page Render IP Restriction to set $session->PageRenderNoCache and that way skip Template Cache for either local or non-local users, even without relying on Pro Cache module. Page Render IP Restriction runs before Template Cache can work it's magic, so this should be possible. Obvious downside here would be that part of your audience won't benefit from caching at all.
    1 point
  25. TinyMCE escapes ampersands automatically, so there's no reason to worry there. They're always stored in their escaped format, "&". Plain textareas store ampersands as-is ("&"), but "HTML Entity Encoder" textformatter automatically escapes them run-time, when you're echoing field content. Ampersands printing as "&" to browser sounds like you're doing escaping twice; any chance that you're escaping content again when printing it, in your template files? Is this consistent, ie. are all ampersands printing out as "&" -- or just some of them? If you're certain that you're not escaping content twice, you might have some broken data in your database. I'd check how those ampersands that print out as "&" are actually stored in the data field of corresponding field_[your-field] table.
    1 point
  26. The method for migrating pages mostly worked. FYI, the bit of code in the middle to make the CSV file needs to use html_entity_decode on the conent it gets from Pages Web Service. I'm putting this together on my Win7 desktop and the only real problem I had may be Win related; the import from CSV complained it could not copy the images into the newly created item's asset folder. The paths were right. Afterwards I used the admin pages to add those images and that was fine. That may fix itself when I move it to a real server (Linux). The next gotcha was that I forgot that having $options passed along through recursive rendering only works with Dev version of PW. With that sorted out, my demo is inside a pretty much standard Blog Profile site. I modified the home page to have fixed content in the middle instead of recent posts. I tested using the blog system's category navigation within my demo and that works nicely. A good thing since integration with CMS is one of the project's features. The demo has its own bare-bones templates and CSS so as not to get too carried away. Initial purpose is to sound out my clients about the more functional and structural features.
    1 point
  27. Funny thing is I can't even get LoginThrottle to work as there's a bug/logik that won't save the attempts to DB, well it does but they get deleted immediately afterwards I filed a issue on github. https://github.com/ryancramerdesign/ProcessWire/issues/198 Back to your issue. You don't need to do anything if you use custom login form. Regarding the code in SessionLoginThrottle. When there's 3 failed attempts within the defined seconds limit it does: ... if(wire('process') == 'ProcessLogin') parent::error($error); else throw new WireException($error); // ensures the error can't be missed in unknown API usage ... Which means if you don't use ProcessLogin to login, it will throw an Exception not an notice! You know you also can render a login form using echo $modules->get("ProcessLogin")->execute(); But this will also result in a Exception thrown, as it's not really the ProcessLogin process running.
    1 point
  28. If you do it simply with a page refresh, rather than ajax, you can simply do something like the following at the top of the page: if($input->get->selected_city){ $session->current_city = $input->get->selected_city; } else{ $session->current_city = $user->user_city; } You can use the $session->current_city directly in your selector. You can choose get or post for the action for your form depending on whether you want the selected_city passed via the url (good for bookmarking) or not.
    1 point
  29. Why not set $session->current_city = $user->user_city and then if they choose an alternative from the select box, change it using: $session->current_city = $input->get->selected_city or something like that, depending on how you process the select box.
    1 point
  30. Turns out the hoster actually IS using mod_sec and blocks certain URLs; got whitelisted now after talking to support. The internet isn't what it used to be...
    1 point
  31. If you look at FieldtypePage getInputfield() it's only InputfieldPage. Then in InputfieldPage you see protected static $defaultInputfieldClasses = array( // default options 'InputfieldSelect', 'InputfieldSelectMultiple', 'InputfieldCheckboxes', 'InputfieldRadios', 'InputfieldAsmSelect', 'InputfieldPageListSelect', 'InputfieldPageAutocomplete', ); InputfieldCheckboxes is only for InputfieldPage alternative input. InputfieldCheckbox is only the input for FieldtypeCheckbox. It's a single checkbox input while InputfieldPage can be multiple. It looks like you are mixing a lot of things up, and looking at your module, your "role_permitted_templates". You have a text field with comma separated values but want to use InputfieldPageName for sanitizing like a page name but which will remove ",". This wouldn't work anyway apart from that you can't use InputfieldPageName here. Just stick with a InputfieldText or InputfieldTextarea, to enter templates comma separated or per line. It would be cool to have a ASM select to select templates, but this would only work if you only use the InputfieldPage with a ASM select, and add templates as options with templateid=>templatename. This unfortunately isn't possible when using a real custom field added to a template, it's only for use when adding it through a hook to a fieldset and on saving take the selected option(s) to save it somewhere.
    1 point
  32. Ah ok I looked a little closer and of course PW doesn't allow special chars in urls. So if you want to use url segments, you can with a little workaround. I updated my code to allow for url segments or GET. Set the variable at the top. Also made some changes to not have lower case the tag. But if you use url segments the $alltags array is used with key=>value to get around it. So it would store "fruehling" => "Frühling", and then take that to get the original value in the image tags find. The sanitizer method $sanitizer->pageName(string, Sanitizer::translate); Sanitizer::translate can be used to convert special chars as you configured in InputfieldPageName module settings. There you can specify that 'ü' will convert to 'ue'. This way you'll get url segments like "fruehling" instead of "frhling" or "fruhling". After all the using of GET urls parameter may be the easiest as you don't have to take care if using cyrillic chars.
    1 point
  33. I've yet to come across a host that doesn't have iconv support. This one comes with PHP and the only way to remove it is to specifically disable it when you compile PHP. Sometimes when dealing with smaller hosts (or those running their own server/VPS) they disable everything they don't recognize. Since iconv is part of PHP's core distribution, it's not something a host should disable unless they are only hosting a single site that they know doesn't need it. Most likely LiquidWeb does have it enabled, but the VPS owner compiled PHP without it. I think the best thing to do here is to ask them to enable it, along with any other PHP core features they may have disabled. Though since your installer didn't report anything else, iconv may be all you need. I don't think ProcessWire uses iconv() anywhere other than the pageName sanitizer, so if you don't want to wait on the host, you could always try modifying that line to an alternate solution.
    1 point
  34. Thanks for this Tutorial. This is the thread that got me finally to take a closer look on PW. Meanwhile, I have been reading various posts and tutorials. I am impressed how easy and fast i get on PW, because im not really a hardcore php coder. But easier than I imagined it in Processwire. I think I've found my new favorite CMS and say thank you MODx for the nice years of cowork but I have to move on.
    1 point
  35. Greetings, Yes, unfortunately, Gretag is gone. I lived througn its demise. They were a good example of what happens when a company refuses to change with the times. They made film-developing machines. When it was clear that film was finished Gretag stuck with it. I remember at one of our final company meetings one of the executives saying that they will not transition to digital because film is better and people will always want what's better. But Gretag is where I made my first "web sites." In 1999, I began building a distributed online help system for their machines. That's when I started using "Macromedia" Fireworks! That was my best non-independent jobs ever. And I really enjoyed traveling to Switzerland. I remember being impressed by how orderly everyone was, that dogs were allowed in restaurants, and the fact that all the clocks in the subways were synchronized. Thanks, Matthew
    1 point
  36. just thought to tell you Ryan that everything *clicked* today. basically, what you were saying was, "create a Template Select input field module and use that for my other module" right? of course I don't have to do that anymore with Hani's module + dependencies but this definitely was lightbulb moment for me thanks
    1 point
  37. I would recommend defining a new role called "deletor" with permissions to view, edit. and delete. Then for the appropriate template you simply give the deletor role the ability to edit the page. Should work as you need. For those templates that should be edit only, only check edit for the editor role, not the deletor role as well. Does that make sense?
    1 point
  38. Hi Luis, weird thing! I have tested a bit with PW Version 2.3 stable, and it seems that PW and PHP also does a right job. But MySQL could be wrong. I have created a float field and it works as you have described, but also when trying to save 10000.11 it store and retrieve 10000.1 !! But to be short, I have tracked the action until to PW saves the value: "INSERT INTO `field_test_float` (pages_id, data) VALUES('1109', '10000.11') ON DUPLICATE KEY UPDATE data=VALUES(data)" After that, I have looked into that field with a MySQL-Editor and it stores 10000,1 and not 10000,11 (When you use 10000,16, it will result into 10000,2) So, after that I have manually edited the field in the MySQL-Editor, typed 10000,11, save, refresh, and voila there are only 10000,1 in it ! It's definitely a MySQL-thing. But I haven't found a solution, only some posts on stackoverflow and mysql datasheets that I do not understand http://stackoverflow.com/questions/4520620/float-precision-problem-in-mysql http://stackoverflow.com/questions/2160810/mysql-whats-the-difference-between-float-and-double http://dev.mysql.com/doc/refman/5.1/en/storage-requirements.html
    1 point
  39. Or you could use SQL directly like so: $pageIDs = array(); $result = $db->query("SELECT id FROM pages INNER JOIN field_intro ON field_intro.pages_id = pages.id WHERE LENGTH(data)<10"); while($row = $result->fetch_row()) $pageIDs[] = $row[0]; $pageArray = $pages->getById($pageIDs); // $pageArray contains what you want EDIT: If kongondo's assumption is correct that you are just looking for an empty intro field, then his approach is the way to go for sure!
    1 point
  40. It sounds like iconv isn't installed on the server - just need to ask Liquidweb to install it for you - that's all. I'm guessing the person who runs the hosting has a VPS package as usually they don't have many modules installed by default. if you want information as to what iconv actually does I'd suggest Googling it, but all the error during install is telling you is that a required module isn't installed and you need it to use ProcessWire properly. In fact, here you go - looks like something to do with supporting different languages/characters: http://www.php.net/manual/en/intro.iconv.php
    1 point
  41. Interesting… I have exactly zero unused designs from last two years, I think.
    1 point
  42. 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
  43. Yeah. We can start by raiding Soma's Gist
    1 point
  44. If you don't need anything in a hurry I will be building a newsletter system along the lines of your requirements but it will be a few months off. It's a module someone is paying me to build, but I'm working on another one first
    1 point
  45. I think this is one of those things that philosophically we don't think belongs in the CMS. You are better off using a service (MailChimp, etc.). Doing large email distributions from your CMS/webserver there is always a danger of your server ending up on an email blacklist. Though I can't argue with the convenience factor (I'm guilty of sending out my small distribution newsletters directly from the server). But if I built this to work right in the CMS, I'd probably feel like I was encouraging some bad practices. Now I've heard of others working on things like MailChimp integration with ProcessWire, and that actually sounds pretty interesting.
    1 point
  46. Never underestimate the importance of word separation. It's the difference in readability between "pen-is-broken" and "penisbroken". Beyond the potential misunderstandings is raw readability both to users and search engines. While I have a readability preference for underscores, my understanding is that hyphens are the best balance when all factors are taken into consideration. Lastly, this may be obvious, but what gets populated in that name box is only an auto-generated suggestion. After populating the title, one can go modify the name as they see fit (which I often do), before saving the page.
    1 point
×
×
  • Create New...