-
Posts
6,221 -
Joined
-
Last visited
-
Days Won
308
Everything posted by bernhard
-
you can filter out unwanted entries BEFORE they are stored in your view or AFTER that (before presentation of data). if you filter them out before storing it, all your reports are free of those unwanted entries and they don't deform indicators like bounce rate and session duration and so on. if you filter them before presentation you would have to apply all those filters on every single report. of course you could do that and you could even save your reports as shortcuts so that you do not have to do this work over and over again, but imagine what happens if you have several shortcut reports and you notice there has a new spider come up... kind of a best practise is to filter data before it gets stored and have one unfiltered view as a backup. @wanze did some research on this but for the moment it's beyond my scope. seems to be not that easy with all the authentication and so on so i thought it would may be a simple and very useful addition to your module. sorry for honoring nico instead of you but you are right - it's not directly what your module was made for so a seperate module would be good... maybe i find the time some day or anybody else what makes me puzzle somehow is that i can't find any howtos or codesamples for this... seems i'm the only one on the web concerning about it ^^
-
you have some code before your <html> that should be in the body! <script type='text/javascript' src='/site/modules/FieldtypeMapMarker/MarkupGoogleMap.js'></script><div id='mgmap1' class='MarkupGoogleMap' style='width: 100%; height: 300px;'></div><script type='text/javascript'>if(typeof google === 'undefined' || typeof google.maps === 'undefined') { alert('MarkupGoogleMap Error: Please add the maps.googleapis.com script in your document head.'); } else { var mgmap1 = new MarkupGoogleMap(); mgmap1.setOption('zoom', 16); mgmap1.setOption('mapTypeId', google.maps.MapTypeId.ROADMAP); mgmap1.init('mgmap1', 51.606968, -0.552179); mgmap1.addMarker(51.606968, -0.552179, '/postcards/chalfont-st-peter/chalfont-st-peter-001/', 'csp-001-f', ''); }</script><!DOCTYPE html> <html lang="en"> <head> <meta name="keywords" content="home improvement, home, improvement, improvements, plumbing, plumber, electrics, electrical, electric, tile, tiling, tiles, joiner, joinery, carpentry, door, doors, stair, stairs, wardrobe, wardrobes, cupboard, cupboards, kitchen, kitchens, bathroom, bathrooms, bedroom, bedrooms, chalfont st peter, buckinghamshire, UK, genealogy, family tree, family, history, tree, ancestor, relative, relation, postcard, postcards"> <meta name="copyright" content="Worldwide, Simon and Thelma Dawson, 2015"> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title>View over Chalfont St Peter</title> <meta name="description" content="" /> <link href='http://fonts.googleapis.com/css?family=Raleway:500' rel='stylesheet' type='text/css'> <link rel="stylesheet" type="text/css" href="/site/templates/styles/main.css" /> <script type='text/javascript' src='https://maps.googleapis.com/maps/api/js?sensor=false'></script> </head> all before <!DOCTYPE html> has to be anywhere between <body> ... </body>
-
of course i mean wanze! i'll get wanze in here... thanks for the link, makes me confident
-
thanks arjen! is it possible to set google analytics filters via API? that would be great. you could then automate this process using piwiks referrer spam list and update all your analytics IDs on the fly. maybe a very useful update for nicos analytics module? how can i invite nico to join this discussion? is there anything like @Nico Knoll ? or do i have to PM him?
-
hi everyone! my google analytics for my personal website looks like this: you see two things: i have very few visitors 90% of them are spam! on this site, i tried using htaccess blocking like this: http://blog.raventools.com/stop-referrer-spam/ but as you can see: no success of course i have also activated the analytics-built-in option to filter known bots and spiders: also useless. only way that seems to work is to manually create filters in analytics. but that's a lot of stupid work if you manage more websites... and with every single new spambot you have to update ALL your websites one by one. that feels so ancient! how do you guys handle this? wouldn't a module be great that has a global library of known bots that we could update with one click? maybe with an option to use the global list of bots and explicitly allow some of them, if there is a need? thanks PS: for search indexing some other keywords: semalt, darodar, buttons-for-website
-
yep, i'm here $map = $modules->get('MarkupGoogleMap'); echo $map->render($page, 'map'); did you read the section "how to use" here http://modules.processwire.com/modules/fieldtype-map-marker/ ?
-
any news on this? or is this obsolete now that wireshell exists?
-
https://www.google.at/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=google%20maps%20calculate%20distance http://stackoverflow.com/questions/7997627/google-maps-how-to-get-the-distance-between-two-point-in-metre/7997732#7997732 http://stackoverflow.com/questions/1502590/calculate-distance-between-two-points-in-google-maps-v3
-
hi guys, i have the following saveReady hook: public function createCodeFile($event) { $page = $event->arguments('page'); if($page->template == 'code' OR $page->template == 'treenode') { // create file if textarea is not empty if($page->code) { $filename = "tmpupload/code" . $page->id . "_" . $page->name . ".inc"; file_put_contents($filename, $page->code); $page->codefile->removeAll(); $page->save('codefile'); $page->codefile->add($filename); unlink($filename); } else { $page->codefile->removeAll(); $page->save('codefile'); } } works great for editing pages, but when i create a new page, i get the error New page '/simple-map/functions/test-test/' must be saved before files can be accessed from it the problem is in the else-block: else { $page->codefile->removeAll(); $page->save('codefile'); } how can i check if "codefile" is accessible? or should i use another hook? if i hooked after "saved" i would have to save the page on my own and that would lead to an endless loop, wouldn't it? thanks for your help!
-
since 2.5.24 OR-dependencies are possible: https://processwire.com/blog/posts/processwire-core-updates-2.5.24/#field-dependencies-upgrades
-
nice! also a good read: https://processwire.com/talk/topic/1799-routes-and-rewriting-urls
- 1 reply
-
- 1
-
thanks! http://php.net/manual/de/language.types.integer.php
-
yes, the helloworld tutorial is a good starting point! thereafter you can easily setup a kind of "sub-template-system" (how you call it) like this: this is the "default intermediate edition" profile - just install this on your dev-environment and read the files _main.php, _init.php and basic-page.php and you will understand how easy it is to setup very flexible and custom things with processwire! also welcome to the forum ps: actually you would only have to append "<?php" on top of _init.php and all your template files - everything else is ready to use!
-
hi baba_mmx, very cool! cstevensjr was faster with the images: https://processwire.com/talk/topic/8597-best-way-to-get-random-quote-displayed-on-refresh/?p=83195 is it a good idea to post your app id and secret? don't know how they are used and if anybody can misuse them? your version number is still 002 and not 2 'version' => 2, don't know what could be the problems but i'm trusting horst and the ryan's helloworld module
-
looks really gut, but personally i was a little bit annoyed by so much scrolling. if you change the whole page on one scroll action its better (for me) than having to roll the wheel over and over to get the new teaser text + image. but others may experience this differently...
-
looks great!
- 3 replies
-
- 1
-
- showcase
- development
-
(and 1 more)
Tagged with:
-
i really respect this approach but i think the possibility should at least be there after clicking on "change" so it would appear beside "cancel" or like the new pageDelete floating right. for my project this behaviour is a nightmare... unfortunately i'm not skilled enough to make this on my own, but i thought maybe this would be a 5-min-thing for ryan or any of the other gurus
-
when a PageListSelect is populated it looks like this: if you want to clear the value of this field rather than changing the referenced page, you have to do lots of clicking if your selected page is somewhere down the tree: it would be great to have a "clear" button right beside the "change" button
-
or on frontend templates: echo "Name: " . $page->fullname; definitely depends on where you want to add "Name: "
-
you can create an autoload module that adds this on save via a hook: look at site/modules/helloworld.module copy+rename it to eg addNameOnSave.module edit classname + content of getModuleInfo() install + test it - it should say "helloworld ..." after save edit your init function: public function init() { $this->pages->addHookAfter('saveReady', $this, 'saveactions'); } remove the helloworld functions and add this one: /** * do some actions on saving */ public function saveactions($event) { $page = $event->arguments('page'); if($page->template == 'your_template') { $page->fullname = "Name: " . $page->forename . " " . $page->surname; } } not tested, hope i did not forget anything
-
populate field value before render
bernhard replied to bernhard's topic in Module/Plugin Development
thank you for that suggestion - unfortunately that has no effect. ha - often asking for help brings up the solution: saving the field before adding the new file does the trick $page->codefile->removeAll(); $page->save('codefile'); $page->codefile->add($filename); -
hey wanze, looks great and could help me a lot if i find time to code some day for what is in my head for a long time ^^ https://github.com/wanze/Pages2Pdf/blob/master/Pages2Pdf.module#L97 shouldn't it check if the user has at least viewing access for the page with the given ID because i think $pages->get(id) via API returns the page independent of its current publishing/hidden state and access? maybe anyone could easyly change the page id and download pdfs of pages he is not allowed to see?
-
populate field value before render
bernhard replied to bernhard's topic in Module/Plugin Development
thank you guys! this works: public function init() { $this->addHookBefore('ProcessPageEdit::buildForm', $this, 'populateField'); // populate textarea field from file content $this->pages->addHookAfter('saveReady', $this, 'createCodeFile'); // create code file from textarea field } public function createCodeFile($event) { $page = $event->arguments('page'); if($page->template == 'code') { // create file if textarea is not empty if($page->code) { $filename = "tmpupload/code" . $page->id . "_" . $page->name . ".inc"; file_put_contents($filename, $page->code); $page->codefile->removeAll(); $page->codefile->add($filename); unlink($filename); } } } public function populateField($event) { $page = $event->object->getPage(); if($page->template == "code") { if($page->codefile) { $page->code = file_get_contents($page->codefile->first()->filename); } } } @adrian you are absolutely right on that - i wanted to explain it but was in a hurry i'm working on an update of geowire. you can devide the map javascript into some logical parts (pw pages) and reuse parts that you need more often. for example you can create a layer like this: var opencyclemap = new OpenLayers.Layer.OSM("OpenCycleMap", ["http://a.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png", "http://b.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png", "http://c.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png"] ); map.addLayer(opencyclemap); this works great using the new ACE editor field! on the other hand, if you have complicated functions/controls with lots of code ACE is not ideal, so i thought it would be great to have the opportunity to edit those files via your favourite editor without having to copy/paste between ACE and your IDE. therefore i need to update the textarea field if the codefile has changed in the meantime! outsourcing the code to a file also has the benefit that i can execute php code like this: var opencyclemap = new OpenLayers.Layer.OSM(<?php echo $page->title ?>, [...] ); but there is one more little problem: when i save the page, the file gets created - filename code1010_test.inc when i save the page again, the old file gets removed, the new file gets created, but the name is code1010_test-1.inc when i save it again, the filename is code1010_test.inc again it seems that the original filename is still blocked although i did a codefile->removeAll() any help for this? -
hi, i want to populate a textarea on render based on the content of a file that is stored in a hidden file field my template looks like this: title ____________ _____________ | | code |___________| codefile code.inc here is my module code: public function init() { $this->addHookBefore('Inputfield::render', $this, 'render'); // populate textarea field from file content $this->pages->addHookAfter('saveReady', $this, 'createCodeFile'); // create code file from textarea field } public function createCodeFile($event) { $page = $event->arguments('page'); if($page->template == 'code') { // create file if textarea is not empty if($page->code) { $filename = "tmpupload/code" . $page->id . "_" . $page->name . ".inc"; // create temp file file_put_contents($filename, $page->code); // remove old files $page->codefile->removeAll(); // ad new file to hidden field $page->codefile->add($filename); // delete temp file unlink($filename); } } } public function render(HookEvent $event) { $field = $event->object; if($field->name == "code") { $field->value = "test"; // works, but what i want is something like this: $field->value = file_get_contents($page->codefile); } } how can i access the page object from the page that contains the field that im hooking? or should i do that completely different? help would be very appreciated as i've been searching quite for a while...