-
Posts
1,306 -
Joined
-
Last visited
-
Days Won
13
Everything posted by Juergen
-
Hello BernhardB, thanks for your response. I create an array of the address entered in the Google map address field. $location = $page->veranstaltungmap->address;//this is the google map address field $location = explode(",", $location);//cut the address into pieces and create the array //create each part of the address with schema.org markup $street = '<span itemprop="streetAddress">' . $location[0] . '</span>, '; $postalcode = '<span itemprop="postalCode">' . $location[1] . '</span>'; $locality = '<span itemprop="addressLocality">' . $location[2] . '</span>, '; $region = '<span itemprop="addressRegion">' . $location[3] . '</span>, '; $country = '<span itemprop="addressCountry">' . $location[4] . '</span>'; As you can see I added a lot of schema.org markup to the various part of the address. This only works if the address is in the correct syntax (street + number, postal code, locality, region, country). If there is one part missing the schema.org part will not be fitting to the output. I hope it is a little bit clearer now. But you gave me a hint: I could query the google api and take this array and its content for creating schema.org markups. I didnt know that this exist - I hope there are no limitations in the amount of queries!!
-
In the description I read: but is it normal that it changes the entered address after geocoding to a certain format?? In my case it changes Plus-Kauf-Straße 1, 4061 Pasching, Oberösterreich, Österreich to Plus-Kauf-Straße 1, 4061, Österreich after pressing the save button - so it shortened the entered address. This is a problem because I have included a lot of schema.org markup and I have created an array from the whole address, where I can pick up the different parts of the address separately. If the address is in another format I run into problems. So this is only if geocoding is on. Best regards
-
Sorting children based on 2 instead of 1 field
Juergen replied to Juergen's topic in API & Templates
Parse Error: syntax error, unexpected '"' (line 45 of /home/.sites/24/site1275/web/site/templates/inc/productitems/productsblogitem.inc) It also doesnt work if the quotes are set correctly - but the error message ist not visible anymore. -
Sorting children based on 2 instead of 1 field
Juergen replied to Juergen's topic in API & Templates
No error anymore, but it doesnt grab the lowest price of the offer (3 €). It only grabs the lowest standardprice (5 €). -
Sorting children based on 2 instead of 1 field
Juergen replied to Juergen's topic in API & Templates
Yes but I got the following error message: Error: Exception: Unknown Selector operator: '' -- was your selector value properly escaped? field='offertprice', value='', selector: 'has_parent=2392, template=productpricelistitem, sort=-standardprice,offertprice' (in /home/.sites/24/site1275/web/wire/core/Selectors.php line 283) -
Source: https://support.google.com/webmasters/answer/2620865?hl=en I understand "You must create a separate url element for each URL" that each page in the sitemap has to include the language tags.
-
Hello @ all, I have created a product page where all products and their lowest price should be visible. Example: Product 1 has -standardprice 1 (fe. small size) -> 5€ -standardprice 2 (fe. medium size) -> 10€ -standardprice 3 (fe. large size) -> 15€ Same product but 3 price variation for different sizes. In addition there is also a special offer price availiable for this product: -offerprice 1 (fe. a second hand used product with a special price ) -> 3€ My aim is to output the lowest price of all in the template. In this case the offerprice of 3€; Every price is a own page, therefore I use this piece of code to find the child pages and sort it by the prices: $productpriceitems = $child->find("template=productpricelistitem, sort=-standardprice"); This piece of code sorts all the prices by the standardprice. My problem: How can I sort them combined with standard and offerprice? ? $productpriceitems = $child->find("template=productpricelistitem, sort=-standardprice AND offerprice"); This piece of code doesnt work. Is there a possibility to sort children combinded with 2 fields? Best regards Jürgen
-
Hi m-artin, thanks for pointing us to this post. I have implemented it on my site and it works quite well. But should not the multilanguage declaration be defined for every page in the sitemap instead for the root page only? Best regards Jürgen
-
Hello @ all, in the past I had the problem that I wanted to add additional markup and manipulations to images that were added with the editor to my body field. My aim was to add Bootstrap framework classes to my images and to add additional containers for certain CSS3 effects. I have tried several ways with dom manipulation, jquery and other php manipulations, but all of them dont satisfy my exact needs. After searching Google i found a php library called "PHP Query" which works similar to jQuery but on serverside. After several tests it seems to me the best way for complex manipulations and so I decided to make a simple textformatter module. It consists of 2 files: the phpquery.php file for the library and the the module file itself which contains the manipulations The php query library file can be found at https://code.google.com/p/phpquery/downloads/list The module file: <?php /** * TextformatterPhpqueryImageFieldMarkupManipulator (1.0.0) * A textformatter module to change the markup of images added via editor with the help of the PHPQuery library. * * @author Kern Juergen * * ProcessWire 2.x * Copyright (C) 2011 by Ryan Cramer * Licensed under GNU/GPL v2, see LICENSE.TXT * * http://www.processwire.com * http://www.ryancramer.com * */ class TextformatterPhpqueryImageFieldMarkupManipulator extends Textformatter { public static function getModuleInfo() { return array( 'title' => "TextformatterPhpqueryImageFieldMarkupManipulator", 'version' => "1.0.0", 'summary' => "A textformatter module to change the markup of images added via editor with the help of the PHPQuery library (https://code.google.com/p/phpquery/).", 'author' => "Kern Juergen", 'href' => "", 'permission' => array( "" ), 'autoload' => false, 'singular' => false, 'permanent' => false, 'requires' => array( "PHP>=5.4.0", "ProcessWire>=2.5.28" ) ); } public function format(&$str) { require('phpQuery.php'); $id = $this->page;//grab the page id $galleryid = 'gallery-' . $id;// create the gallery $document = phpQuery::newDocumentHTML($str); // Selects all image elements added via editor $matches = $document->find('img'); foreach ($matches as $match) { //starting manipulations - examples (you can find more and a documentation at https://code.google.com/p/phpquery/wiki/Manual) pq('a > img')->addClass('linked'); //add linked class to all linked images pq('img')->addClass('img-responsive')->addClass('thumbnail'); //add thumbnail and responsive class to all images pq('.linked')->removeClass('thumbnail'); pq('a > img')->wrap('<span class="scalecontainer"></span>')->before('<span class="roll"></span>'); //add additional markup to images with links pq('img')->parents('a')->addClass('thumbnail')->attr('data-lightbox', $galleryid); //add thumbnail class to the link to the larger version and the data attribute pq("a > span > img.align_left)")->parents('a')->addClass('align_left'); pq("a > span > img.align_right)")->parents('a')->addClass('align_right'); pq("a > span > img.align_center)")->parents('a')->addClass('align_center'); pq("p > a.align_center)")->wrap('<div class="image-center"></div>'); pq("p > img.align_center)")->wrap('<div class="image-center"></div>'); //end manipulations } $str = $document; } } The module file includes the phpquery with the require command. $matches = $document->find('img');// Selects all the images This line of code grabs all images //starting manipulations - you will find more info at https://code.google.com/p/phpquery/ //These are some manipulations pq('a > img')->addClass('linked');//add linked class to all linked images pq('img')->addClass('img-responsive')->addClass('thumbnail');//add thumbnail and responsive class to all images pq('.linked')->removeClass('thumbnail'); //remove class thumbnail on linked images pq('a > img')->wrap( '<span class="scalecontainer"></span>' )->before('<span class="roll"></span>'); //add additional markup to images with links pq('img')->parents('a')->addClass('thumbnail')->attr('data-lightbox', $galleryid); //add thumbnail class to the link to the larger version and the data attribute pq("a > span > img.align_left)")->parents('a')->addClass('align_left'); pq("a > span > img.align_right)")->parents('a')->addClass('align_right'); pq("a > span > img.align_center)")->parents('a')->addClass('align_center'); pq("p > a.align_center)")->wrap( '<div class="image-center"></div>' ) ; pq("p > img.align_center)")->wrap( '<div class="image-center"></div>' ) ; //end manipulations This is the manipulation section. You can find a lot of examples at the php Query site. The best is that you can use CSS3 selectors to match a certain element on the page. This makes it much easier. I only posted this module for others who are interested in manipulating images. You use it at your own risk and I doesnt make it public on Github. The manipulations are only for my purpose and you can make your own. Just write it between "//These are some manipulations" and "//end manipulations". Install the module at site/modules/ and add this textformatter module to your editor field. All the images added with the editor will be manipulated in an elegant way. Best regards Jürgen PS.: I am not a skilled PHP pro, I have never learned it at a professional level. So if anybody has improvements please post it here Edit: The include of the phpquery.php file should usualy be at the top of the module file, but in this case it can make problems during the installation of the textformatter. This is the reason why I added it inside the function. If you run into problems after the installation please add this line of code to the top and everything works fine. TextformatterPHPqueryImageFieldMarkupManipulator.zip
- 1 reply
-
- 4
-
How to fill a field automatically after a page is published?
Juergen replied to Michael van Laar's topic in General Support
This is the simple way how to include all your hooks after page save: https://processwire-recipes.com/recipes/extending-page-save-process/ -
I have another problem with Fredi and file upload. I have created a repeater field with a file upload field (and other fields). In the backend the file upload works quite well, but in the frontend it doesnt grab the file after uploading. Here is a video i made. https://youtu.be/TlFZJ7HMcQc Does anyone has the same problem?
-
Hello laban, I use the latest firefox and in my case your sitemap is working, but I am not able to see how many links are in there.
-
I am also using page tables but I have no problems at all. Maybe it is an CSS problem? As you can see, the close button is there.
-
I have a general question about adding files to a template file. In PW you can use in the file tab of a template the possibility to add a prepend and a append file (fe header and footer) to a template. I have included them directly in the template with the include function. Is there a difference or advantage of using prepend/append in opposition to the include or doesnt it matter? Best regards
-
Unfortunately it doesnt work with FREDI in modal windows.
- 67 replies
-
- Inputfield
- UI
-
(and 2 more)
Tagged with:
-
I have installed it at a 2.6.10 dev version. The installation process was successfull, but if I want to check the links I get the following messages: 2015-07-31 17:30:34 admin START: id!=2, has_parent!=2 2015-07-31 17:30:34 admin BATCH: 1/2 (pages 1-52/52) 2015-07-31 17:30:34 admin FOUND Page: / 2015-07-31 17:30:35 admin CHECKED URL: http://www.juergen-kern.at/site/templates/favicon.ico (200) Warning: PDOStatement::execute(): MySQL server has gone away in /home/.sites/24/site1275/web/site/modules/ProcessLinkChecker/LinkCrawler.php on line 405 Warning: PDOStatement::execute(): Error reading result set's header in /home/.sites/24/site1275/web/site/modules/ProcessLinkChecker/LinkCrawler.php on line 405 Fatal error: Exception: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away (in /home/.sites/24/site1275/web/wire/core/Modules.php line 2264) #0 /home/.sites/24/site1275/web/wire/core/Modules.php(2264): PDOStatement->execute() #1 /home/.sites/24/site1275/web/wire/core/Modules.php(2523): Modules->getModuleConfigData(Object(ProcessPageSearch)) #2 /home/.sites/24/site1275/web/wire/core/Modules.php(446): Modules->setModuleConfigData(Object(ProcessPageSearch)) #3 /home/.sites/24/site1275/web/wire/core/Modules.php(1032): Modules->initModule(Object(ProcessPageSearch), false) #4 /home/.sites/24/site1275/web/wire/core/Modules.php(939): Modules->getModule('ProcessPageSear...') #5 /home/.sites/24/site1275/web/wire/modules/AdminTheme/AdminThemeReno/default.php(25): Modules->get('ProcessPageSear...') #6 /home/.sites/24/site1275/web/wire/core/admin.php(148): require('/home/.sites/24...') #7 /home/.sites/24/site1275/web/wire/modules/AdminTheme/AdminThemeReno/controller.php(13): require('/home/.sites/24...') #8 /home/.sites/ in /home/.sites/24/site1275/web/index.php on line 254 Error: Exception: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away (in /home/.sites/24/site1275/web/wire/core/Modules.php line 2264) #0 /home/.sites/24/site1275/web/wire/core/Modules.php(2264): PDOStatement->execute() #1 /home/.sites/24/site1275/web/wire/core/Modules.php(2523): Modules->getModuleConfigData(Object(ProcessPageSearch)) #2 /home/.sites/24/site1275/web/wire/core/Modules.php(446): Modules->setModuleConfigData(Object(ProcessPageSearch)) #3 /home/.sites/24/site1275/web/wire/core/Modules.php(1032): Modules->initModule(Object(ProcessPageSearch), false) #4 /home/.sites/24/site1275/web/wire/core/Modules.php(939): Modules->getModule('ProcessPageSear...') #5 /home/.sites/24/site1275/web/wire/modules/AdminTheme/AdminThemeReno/default.php(25): Modules->get('ProcessPageSear...') #6 /home/.sites/24/site1275/web/wire/core/admin.php(148): require('/home/.sites/24...') #7 /home/.sites/24/site1275/web/wire/modules/AdminTheme/AdminThemeReno/controller.php(13): require('/home/.sites/24...') #8 /home/.sites/ This error message was shown because site is in debug mode ($config->debug = true; in /site/config.php). Error has been logged.
-
I have added this to the wishlist some time ago :https://processwire.com/talk/topic/10074-file-upload-field-for-multilingual-site/ I hope it will be added in the future to the file upload fields.
-
Little mistake - big effect: The syntax for the minutes was wrong: It has to be %M and not %m - now the date is correct multilingual
-
In the current version of PW (2.6.9 dev) it is possible to add the date format via the PHP strftime syntax to get localized output. In my case I get a difference of 7 minutes between the choosen time in the backend and the outputted time in frontend. This is the date/time that I choose in the backend. The output format for each language in the field is like this: 1) German output format 2) English output format And this is what i looks like in the frontend: 1) German 2) English So as you can see the monthname is in the correct language and the time is also the correct format but I have got a difference of 7 minutes between the output on the frontend and the choosen time in the backend (18:07 instead of 18:00 in German and 06:07 PM instead of 06:00 in English). Could the cause be a server time problem where I hosted this site? Best regards Jürgen
-
-
Problem with multilingual site. If the site is multilingual and you want to find a specific template to edit it is very troublesome to find the right template, because the name of the template is shortened. In this case it is impossible to use Strg + F to find the template you want to edit. So it would be better to leave the template file name path intact and do not shortened it with ....... otherwise you will go cracy. The search function doesnt work in this case. Edited: It is possible to find the right translation file in the "Select File(s)" area in the backend - I found it out a moment after I have posted this.
-
The image grid in Firefox 39 is also displayed correctly since the update. The description is now above. Well done!
-
Yeah, user image will be displayed since the last update - Thanks Renobird
-
Hello Renobird, is it possible to add target="_blank" to the custom links in the top nav? I have tried to do this like that in the admin.php: "target" => "_blank" But this doesn`t work! Best regards Jürgen