Leaderboard
Popular Content
Showing content with the highest reputation on 03/16/2013 in all areas
-
Hey, my very first Processwire module, so please give any feedback possible about the code. Ported from my actual project, maybe its usefull for someone. Main code for tracking based on the clickHeat Project by labsmedia, generated Heatmaps via heatmap.js What it does: Tracking clicks of your visitors Generate a list in admin backend of tracked sites Generate a Visual Heatmap of the tracked clicks. Requirements: processwire 2.3 jQuery 1.9 a folder in /assets/logs/clicks with write permission I don´t have a git repo, I´m sorry. Installation: copy the Folder Heatmap to your site/modules folder. Install the Module: WireDataHeatmap Install the Module: ProcessListHeatmaps Go to your template admin and assign to every template you wish to make trackable the checkbox field track_heatmap Now check this field on every page you wish to be tracked. Known bugs so far: x coordinates about 40px too far in the right. Will fix this issue the next days. Screener and .zip //EDIT 2013/03/16 Roadmap (everybody needs a tiny roadmap ) - change click save from file to database via $page->save() - tidy up the code! -- *almost - segmentation via date range .... learn git? //EDIT 2013/03/17 New Version 0.0.2 Changed saving clicks to files into $page->fieldtype->textarea worked on heatmap calculus... still not working properly, bit too much offset left. trying to fix this problem :-/ update instructions: uninstall old module delete old module files copy folder heatmap to your modules folder and install both new modules. Now add field "track_heatmap" to every template you wish to provide tracking function. Now just check the field on every page you need to be tracked. The module adds his data container to every tracked page after the first registered click. //EDIT 2013/03/18 New Version 0.0.3 little improvement to visualized data. Heatmaps not yet accurate on fluid layouts, some clicks need some browser resizing to match the correct position Updated the attached .zip Heatmap.zip6 points
-
Hi this is my new onepager site for the thesouplibrary.com using: processwire jquery scrollto.js parallax.js3 points
-
Ok sorted it out. You can't use multiple or | with name field in a selector, since name it's not a text field like others. So to make it easy you would have to first check if there's one with "name" found or check for further fields. Here's a working code with some notes you would have in your home.php at the top. if(count($input->urlSegments) > 1) { // not more than two segments throw new Wire404Exception(); } if(count($input->urlSegments) == 1) { // sanitize to make sure it's valid page name $seg1 = $sanitizer->pageName($input->urlSegment1); // search for name since name can't be used with or "|" multiple field selector $found = $pages->get("parent=/landing-pages/, name=$seg1"); if($found->id) $session->redirect($found->url); // if page with name of url segment not found search alternative fields.. $found = $pages->find("parent=/landing-pages/, short_url=$seg1")->first(); if($found->id) $session->redirect($found->url); // if we reached here, nothing found, throw a 404 throw new Wire404Exception(); } In case you want to leave at the short url and not redirect, you could just render the found page and exit: if($found->id){ echo $found->render(); exit(0); } In case you got questions just ask.3 points
-
Updated version of this module just found its way into GitHub. Now there's a config option "Enabled templates" letting you choose the templates you want the "References" tab to be added to (when editing a page with those templates). If no template is chosen, "References" tab is always shown. Templates with system-flag are always skipped, like fields with system-flag have been from the beginning.2 points
-
I just recently did create a code example to generate a language switch with LanguageLocalizedURL that might be of interest. https://gist.github.com/somatonic/5130992 And linked from in the readme of the module https://github.com/mcmorry/PW-language-localized-URL/blob/master/README.md#language-switch-example2 points
-
I'm pretty close to having native core support for multi-language page names. It's something I wanted to add originally in 2.1, but just didn't know exactly how without adding lots of overhead. After marinating on it for a long time, an easy way to accomplish it finally became apparent. A nice thing about it is that it does it with near zero overhead. It won't be as fancy as the LanguageLocalizedURL module, but it should be good for people that have relatively simple needs. It's the one feature that we were missing that would really let the multi-language fields sing, and it should lead the way for making more fieldtypes multi-language capable. It works by enabling you to specify an alternate name for each page, for each language. When a page is accessed at its alternate URL, then the language is automatically detected and set for the request. Combined with multi-language fields or multi-language alternate fields, it provides a full multi-language solution without need for multiple trees or having to use any code to set the language. It's not the right solution for all situations, but for some situations, it'll be quite nice. Lets say you've got the page /about-us/contact/. For the "about-us" page you've set the Spanish language name to be "quienes-somos", and for the "contact" page you've set the Spanish language name to be "contacto". When the URL /quienes-somos/contacto/ is accessed, it's technically referring to the same page as /about-us/contact/, except that the user's language is automatically set to Spanish, and thus any multi-language fields output in Spanish. Calls to $page->url on any other pages also output the Spanish URLs. You don't have to define alternate labels for all pages if you don't want to. So long as there is just one of them in the URL (like in the rootParent, for example) then it'll be able to detect the language automatically. In order to avoid problems with having multiple URLs displaying the same content, it doesn't let you access the page with a URL like /about-us/contacto/ (English and Spanish mashup), because both of those pages have their names translated. So if you accessed such a URL, it would 301 redirect to the Spanish version. Here's a screenshot that might help to explain how these things are defined. This will be committed to the core within the next few days, as part of the LanguageSupport group of modules, but I'm going to leave it as an uninstalled alpha then beta module, until ProcessWire 2.4.1 point
-
Page References Tab This little module adds a new tab, References, to the page editor. There it lists pages referencing the page that is being edited (title, path, field). There are also links to view or edit the listed pages (if they're viewable/editable). Only fields of type FieldtypePage are considered to be references and system fields are not listed at all (roles, permissions). It's nothing much, but as the subject has turned up a couple of times in the forums, I decided to give it a try. So watch out what you're asking! Screenshot Links Modules directory: http://modules.processwire.com/modules/page-references-tab/ GitHub: https://github.com/niklaka/PageReferencesTab1 point
-
1 point
-
I also have a site hosted on Strato and in the beginning was veeery slow. I talked about this on this forum thread http://processwire.com/talk/topic/847-max-cafe-bar/, Check Georgson's answer at the end, might be useful.1 point
-
1 point
-
Since your site is simple like you say, I would just make one branch in the tree per language. i.e. /en/ /about-us/ /contact/ /es/ /quienes-somos/ /contacto/ If you want to be able to translate static text in your template files, you'll want to also use code internationalization. Solutions like LanguageLocalizedURL and the new LanguageSupportPageNames become more valuable when the scope of maintaining two trees (like above) becomes too much work. But if it really is a simple/small site, then keep it simple.1 point
-
Now Im still confused even more. You say it should always have the same value but still different for each language. My last suggestion works with what?1 point
-
This has nothing to do with languages anyway.. Your code is missing the ..->url at the end.1 point
-
1 point
-
Then why do you make it a language field at all? Btw why not just add the field to home and alway get it from there? $pages->get("/")->company1 point
-
That should work. You could also do it this way: $page->htl_idiomas->removeAll(); foreach($input->post->htl_idiomas AS $idioma_id ) { $p = $pages->get((int) $idioma_id); if($p->id && $p->viewable()) $page->htl_idiomas->add($p); } However, something that is missing that you definitely want to add is more validation. Meaning, check to make sure that the pages you are adding to itl_idiomas are in fact the pages you intend. This prevents the possibility of someone manipulating the POST values to include page IDs outside of those you allow. So I would do this instead: $idiomas = $pages->get('/tabla/idioma/')->children(); $page->htl_idiomas->removeAll(); foreach($input->post->htl_idiomas AS $idioma_id ) { $p = $idiomas->find("id=" (int) $idioma_id)->first(); if($p && $p->viewable()) $page->htl_idiomas->add($p); }1 point
-
1 point
-
Thanks Diogo, I've corrected that. Those quick start tutorials were written by somebody that never finished them... and they were written back for the original PW 2.0, so I'm not surprised there might be errors in there. I need to take some time to go through these for QA, because I don't think the author is going to finish them. But people seem to like them... every time I remove them, somebody gets upset.1 point
-
Thanks for your input Diogo Though your variation of sivutyyppi is quite an interesting one Sorry guys for delay with this. No excuses, but got pretty close zero coding time last week.1 point
-
Sivutyypii sounds good to me. But not necessarily better than sivupohja. I like both1 point
-
Slightly out of topic, just to say that this evening there is no programming. Just this https://www.youtube.com/watch?v=RVJUJF6Rg1Q1 point
-
I must say it's a very good looking app. I installed it on fortrabbit to test. (Craft this is the former Blocks CMS, for those who are wondering)1 point
-
Never mind, think I found a solution. For anyone else having the same issue. Go to Setup > Templates. Choose a template, and then under family you can select Yes/no for "may pages using this template have children". There's also another option, "Can this template be used for new pages?". Brilliant! @renobird > Just found a way myself, as you can see. But your suggestion is yet another way to do it. Perfect. Thanks!1 point
-
Here is a draft of the module that I talked about above <?php //ModifiedMinusCreated.module class ModifiedMinusCreated extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Modified minus created', 'version' => 100, 'summary' => 'only a rough draft', 'singular' => true, 'autoload' => true, ); } public function init() { $this->pages->addHookBefore('save', $this, 'subtract'); } public function subtract($event) { $page = $event->arguments[0]; if(!$page->fieldgroup->modifiedminuscreated) return; $page->modifiedminuscreated = $page->modified - $page->created; } Now you just have to create the integer field "modifiedminuscreated" and add it to the templates you want. edited: changed the code under Soma's suggestion1 point
-
The Thumbnails field has the same setting for showing thumbnails in the admin as has the normal image field. Go to the input tab and check "show thumbnails in page editor"1 point
-
You better not merge but replace the new "wire" folder. Since session module is now in it's own folder (with db session module) this happens if you merge it with old wire folder. So there's 2 instances of the same module.1 point
-
If the garbage collector on server is set wrong this can happen. The good news, there's is now DB session module in PW since some versions in dev already to handle session via DB. Just install it. https://github.com/ryancramerdesign/ProcessWire/tree/dev/wire/modules/Session1 point
-
I'm not sure this was already before but when editing page there a token doublicate in html source: <label class='ui-widget-header' for=''>Children / Subpages</label> <div class='ui-widget-content'> <div id='PageListContainer' data-token-name='TOKEN1566834131' data-token-value='e633e7ae0a8d5d91d6a630f0d180853b655a560ade29f71a8f9c1e279bc2c09d'></div> <div id='PageListContainer' data-token-name='TOKEN1566834131' data-token-value='e633e7ae0a8d5d91d6a630f0d180853b655a560ade29f71a8f9c1e279bc2c09d'></div> <ul class='Inputfields'> ...1 point
-
I just moved a site from my local MAMP to the production server and could not login. I tried everything suggest here in the forum, but the "forged" message remained. Because I did not want to upload all sessions I excluded the "/site/assets/sessions/" folder when uploading the site by ftp. As soon as I created the "/site/assets/sessions/" folder by hand on the server everything worked again. Conclusion: Remember that you need these folders: /site/assets/cache/ /site/assets/logs/ /site/assets/sessions/1 point
-
Thanks for the links! Here are some I have bookmarked: 01. http://net.tutsplus.com/tutorials/php/the-best-way-to-learn-php/ 02. http://php.net/manual/en/getting-started.php 03. https://phpacademy.org/ 04. http://www.coursehero.com/courses/5/Intro-To-PHP/#intro 05. https://tutsplus.com/course/php-fundamentals/ 06. http://net.tutsplus.com/sessions/codeigniter-from-scratch/1 point
-
I got Internal Server Error when i tried to install PW. That trick worked, thanks! I have Ubuntu server with Virtualmin.1 point
-
1 point
-
1 point
-
I'm using MySQL Dumper to backup the database. Configure it once and then you will have your backups as tar.gz files on the server. Now you could use Cobian to save these or - another feature of the MySQL Dumper save the backup to an external FTP server. It's running for two years now on my old forum without problems.1 point
-
I vote for electronic music... Sometimes a bit faster, sometimes relaxed and slowly. https://soundcloud.com/underworld/always-loved-a-film-underworld http://groovera.com1 point
-
yup, php is the language that drives the web - and processwire. I wished I started learning php 10 years ago. https://tutsplus.com/course/php-fundamentals/ http://www.w3schools.com/php/default.asp http://www.tizag.com/phpT/1 point
-
Jenn, Wow! Excellent work. The site looks and works great! One quick thing: The "Parent Orientation" quicklink on this page results in a 404. http://fyp.washington.edu/getting-started-at-the-university-of-washington/ I work at a University as well. Most of campus uses WP or Drupal, so I feel a bit like a lone wolf using ProcessWire (sounds cooler than black sheep). I think that's starting to change though—ProcessWire powered sites are starting to spring up around campus. Anyhow, great site—thanks for sharing.1 point
-
@Jennifer Please take all these comments and criticisms in the best constructive light possible. We mean the best for you and only want to help you. With that said, here are a few simple things you can do to speed up your site: 1. I see you are linking to foundation.css You should use foundation.min.css. It's 84KB, as compared to 101KB for the one you are using. A small difference, but many small differences make quite a big deal! 2. You are using lots of fonts no your site. Using many font styles can slow down your webpage, so only select the font styles that you actually need on your webpage. Instead of doing this: <link href='http://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,300,700' rel='stylesheet' type='text/css'> <link href='http://fonts.googleapis.com/css?family=Bitter:400,700,400italic' rel='stylesheet' type='text/css'> Do this instead: <link href='http://fonts.googleapis.com/css?family=Bitter|Open+Sans' rel='stylesheet' type='text/css'> I'm actually looking at those two fonts you chose and dig this up from my bookmarks: http://designshack.net/articles/typography/10-more-great-google-font-combinations-you-can-copy/ 3. Checkout http://yslow.org/ It's a browser addon/extension/plugin thingie that give your tips on improving your site speed. It's a great tool! We look forward to hearing from you.1 point
-
Hi, I had a similar issue with one.com. Support suggested to comment out the following within the .htaccess file: #Options -Indexes #Options +FollowSymLinks Also: #<IfModule mod_php5.c> #php_flag magic_quotes_gpc off #php_flag magic_quotes_sybase off #php_flag register_globals off #</IfModule> That worked for me but I am concerned it may cause issues down the road! Big thanks for all the hard work you guys have put into processwire. I've spent a day running through the tuts and It already feels like a great piece of kit, plus real friendly community.1 point
-
Just reading Soma's post on delegation and thinking about how I am using functions more and more, I am wondering if I can sort of mix and match. Basically, it more or less follows what Soma is doing, but in addition, using the template name to define additional includes or functions (however you are working). So, you would perhaps have a template that you called category-news-headlines Exploding the name gives you three parameters - category, news and headlines Category would be the name for this particular template for purposes of differentiation but also may be defining that this is listing something by category. News might be the general theme you are calling in, a wrapper theme with a certain layout style or something Headlines would be something more specific, perhaps - some way of laying out the actual articles that has a big main article, is looking for featured content or something. Another variation would be a template called category-news-list which does the same thing, except the news would just appear as a list. On the actual template file, you split up the template name and use the parameters to call in the right elements. The advantage here is that you can create more variations without actually having to create more than a basic set of included files or functions. You are simply mixing and matching. This only works on a site (or a sections of a site) where you are using identical fields for all the templates. Of course, there is a rather valid argument that it would be better (and a lot easier) just to define the additional parameters with select/pages fields, but it is an idea that might have other uses.1 point
-
Hi diogo! Just to let you and others know: Strato offers a "SpeedPlus" package, which is free for existing customers - and makes backend and frontend faster. Not the best speed overall, but it is not annoying any longer...1 point
-
1 point
-
The recursive loop comes from your $p->save(); which is again triggering your pageSaved() hook, and continues doing so infinitely to a deeper and deeper level. There's probably a bunch of ways to solve this. But here's two really simple ways. First is to just set some landmark variable (we'll call it skipMe) so that your hook will know to skip over pages that it is creating itself. Your landmark variable (skipMe) doesn't need to be a PW field or anything, as you can make up any name/value on the fly and set it to a $page for temporary use like this. public function pageSaved($event) { $page = $event->arguments[0]; if($page->skipMe) return; $p = new Page(); $p->template = 'basic-page'; $p->parent = '/about/'; $p->status = Page::statusUnpublished; $p->title = "This is the pagename"; // set some landmark so pageSaved knows to skip this one $p->skipMe = true; $p->save(); } The next option would be to just have your $p->save(); skip over all hooks: $p->___save(); When you call the function name with 3 underscores in front of it, it does so without executing any hooks, thereby preventing the infinite loop. However, this may or may not be what you want, because it would also skip over any other Pages::save hooks that might be present.1 point
-
1 point
-
This is the way to create template and fields with API: // new fieldgroup $fg = new Fieldgroup(); $fg->name = 'new-template'; $fg->add($this->fields->get('title')); // needed title field $fg->save(); // new template using the fieldgroup $t = new Template(); $t->name = 'new-template'; $t->fieldgroup = $fg; // add the fieldgroup $t->noChildren = 1; $t->save(); // add one more field, attributes depending on fieldtype $f = new Field(); // create new field object $f->type = $this->modules->get("FieldtypeFloat"); // get a field type $f->name = 'price'; $f->precision = 2; $f->label = 'Price of the product'; $f->save(); // save the field $fg->add($f); // add field to fieldgroup $fg->save(); // save fieldgroup All pretty much standard OO one can figure out looking at core and PW modules. But not someone unexperienced would figure out by themself. I think at some point we need to cover these in a documentation.1 point
-
Thanks Statestreet! Here is the most common and accessible way of doing it in ProcessWire (using $config->ajax). Your template that renders the ajax-loaded pages would look something like this: <?php if(!$config->ajax) include("./head.inc"); // include full site header if not ajax echo $page->body; // output all content here that is common to ajax and full version if(!$config->ajax) include("./foot.inc"); // inclue full site footer if not ajax Then in your site, output all the links with href attributes pointing to each page's URL. You might output nav like this: <?php foreach($pages->get("/")->children() as $child) { echo "<a class='ajax' href='{$child->url}'>{$child->title}</a>"; } From the JS/jQuery side, you would capture the click event on all class="ajax" links and let jQuery pull the content in and populate the container (called #content in this case): $(document).ready(function() { $("a.ajax").click(function() { $.get($(this).attr('href'), function(data) { $("#content").html(data); }); }); }); Using this method, clients that have JS/ajax support get the ajax version of the site. Clients that don't have it get a 100% regular and accessible non-ajax site. The only thing that you had to do was have your template check $config->ajax to determine if it was being loaded by ajax, and respond with the appropriate output.1 point