-
Posts
29 -
Joined
-
Last visited
Everything posted by fliwatuet
-
Thanks for your help @adrian it is working now! Solution: (function ($) { $( document ).ready(function() { $('#Inputfield_city').on( 'blur', function() { var address = $('#Inputfield_street').val() + ', ' + $('#Inputfield_city').val(); $('#Inputfield_location').val(address); $('#Inputfield_location').blur(); }); }); }(jQuery));
-
This is working: (function ($) { window.onload = function() { alert('LOAD LOAD'); }; }(jQuery)); The alert window shows up.
-
Both scripts are working in the console but none is working in the edit form. Strange... The header, when editing content: <script type='text/javascript' src='/site/templates/AdminCustomFiles/basic-page.js'></script> Edit: tried a different browser, nothing happens when editing...
-
@adrian here is what I did: Install the module and set Enable for process to ProcessPageEdit, (Page Edit) Create two fields: street, city Add these two fields to the template basic-page and arrange them ahead the map marker field Create a file called basic-page.js in /site/templates/AdminCustomFiles/ Content of the file: $('#Inputfield_city').on( "blur", function() { var address = $('#Inputfield_street').val() + ', ' + $('#Inputfield_city').val(); $('#Inputfield_location').val(address); $('#Inputfield_location').blur(); }); I checked in the source code while editing the content, the file basic-page.js is loaded. But nothing happens. Where is the mistake?
-
Thanks @AndZyk and @adrian I will give it a try, AdminCustomFiles look easier to me to understand and implement than hooks. Maybe I use just a dropdown for city and the map marker field for the address.
-
Tutorial beyond basic stuff? Best way to learn...
fliwatuet replied to fliwatuet's topic in Getting Started
Thanks @szabesz for the link! @Ivan Gretsky I will do my very best -
Howdy! Are there any tutorials that go one step or more further than the basic tutorials at processwire docs? I want to build a site very similar to the skyscrapers demo, I already looked at the code of this demo, but it is really hard to understand what to do when and in which way. Also I don't want to "steal" the code from the demo and just change it to fit my needs. I want to learn how to build such a site. Do you have any suggestions on how to do this? I want to build a site for a soccer club, where all the soccer grounds in the league are listed, with map, description, information about the opponent club etc.
-
Thanks @AndZyk! This hook-stuff looks a bit complicated at first glance. Is there a tutorial for that?
-
Thanks @AndZyk and @adrian! For the end user it will be easier to use the map marker field but then there is a chance that they forget the commas to separate the values. Three or more different fields are not that comfortable to use, copy and paste is not possible. Which way do you think is the best solution? Or is it possible to sort and filter a "view" (Drupal background ) by e.g. City or postal code out of the map marker field when retrieving all location pages? I looked at the skyscraper demo but it is hard to understand.
-
Ok, Map Marker is working right now, but it is still not the way, I want to set it up, because the address is in on field an not divided in Street, Postal Code, City. Any ideas how to do this?
-
It is working for me now, I guess it is a problem within your template file @alec.
-
What do you mean? I added the map field to the home template and then edited the home page, put an address into the map field. I then edited the home.php template file and the _main.php. No errors as far as i can see.
-
Yes, the field is called map. This is working fine: $page->map->address $page->map->lat $page->map->lng $page->map->zoom I changed the code to your suggestion, now there is no error message anymore, but still no map...
-
Hello! I want to build a page with these fields: Street, Postal Code, City Call it an address Then I want to take this address, geocode it and display it on a map. How can I achieve this? I started with Map Marker (Google Maps) and Leaflet Map Marker but I am not able to get them working. Is there any other possibility? I am not a php programmer, I can't code a module for that.
-
Maybe it should be mentioned in the tutorials, how to do this.
-
This is the original file (I took out the comments): <?php namespace ProcessWire; ?><!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title><?php echo $title; ?></title> <meta name="description" content="<?php echo $page->summary; ?>" /> <link href='//fonts.googleapis.com/css?family=Lusitana:400,700|Quattrocento:400,700' rel='stylesheet' type='text/css' /> <link rel="stylesheet" type="text/css" href="<?php echo $config->urls->templates?>styles/main.css" /> </head> When I add <?php $map = wire('modules')->get('MarkupLeafletMap'); echo $map->getLeafletMapHeaderLines(); ?> right before </head> I still get the error message mentioned above when I use "echo $map->render($page, 'map');" in home.php! BTW: the map in the backend is working.
-
Is it possible that php 7 causes this problem?
-
I tried. But whenever I put <?php $map = wire('modules')->get('MarkupLeafletMap'); echo $map->getLeafletMapHeaderLines(); ?> in the head section of _main.php I get this error message: Error: Uncaught Error: Call to a member function render() on null in /home/html/portal.dev/site/templates/home.php:14 Stack trace: #0 /home/html/portal.dev/wire/core/TemplateFile.php(268): require() #1 [internal function]: ProcessWire\TemplateFile->___render() #2 /home/html/portal.dev/wire/core/Wire.php(374): call_user_func_array(Array, Array) #3 /home/html/portal.dev/wire/core/WireHooks.php(549): ProcessWire\Wire->_callMethod('___render', Array) #4 /home/html/portal.dev/wire/core/Wire.php(399): ProcessWire\WireHooks->runHooks(Object(ProcessWire\TemplateFile), 'render', Array) #5 /home/html/portal.dev/wire/modules/PageRender.module(515): ProcessWire\Wire->__call('render', Array) #6 [internal function]: ProcessWire\PageRender->___renderPage(Object(ProcessWire\HookEvent)) #7 /home/html/portal.dev/wire/core/Wire.php(374): call_user_func_array(Array, Array) #8 /home/html/portal.dev/wire/core/WireHooks.php(549): ProcessWire\Wire->_callMethod( (line 14 of /home/html/portal.dev/site/templates/home.php) This error message was shown because: you are logged in as a Superuser. Error has been logged.
-
This is my home.php: <?php namespace ProcessWire; echo $page->map->address; // outputs the address you entered echo $page->map->lat; // outputs the latitude echo $page->map->lng; // outputs the longitude echo $page->map->zoom; // outputs the zoom level $map = wire('modules')->get('MarkupLeafletMap'); echo $map->getLeafletMapHeaderLines(); echo $map->render($page, 'map'); // home.php (homepage) template file. // See README.txt for more information // Primary content is the page body copy and navigation to children. // See the _func.php file for the renderNav() function example $content = $page->body . renderNav($page->children); // if there are images, lets choose one to output in the sidebar if(count($page->images)) { // if the page has images on it, grab one of them randomly... $image = $page->images->getRandom(); // resize it to 400 pixels wide $image = $image->width(400); // output the image at the top of the sidebar... $sidebar = "<img src='$image->url' alt='$image->description' />"; // ...and append sidebar text under the image $sidebar .= $page->sidebar; } else { // no images... // append sidebar text if the page has it $sidebar = $page->sidebar; }
-
Hi! I have problems displaying the map. It is not showing up. I installed all the modules, setup the field and the template and put the following in my template file (home.php with delayed output): echo $page->map->address; // outputs the address you entered echo $page->map->lat; // outputs the latitude echo $page->map->lng; // outputs the longitude echo $page->map->zoom; // outputs the zoom level $map = wire('modules')->get('MarkupLeafletMap'); echo $map->getLeafletMapHeaderLines(); echo $map->render($page, 'map'); Address, lat, lng and zoom are printed out, but there is no map. What am I doing wrong? I am not a coder. Looks like sonething is messed up, the source code of the page looks like this Is that the correct? It is the same problem as with the google map marker field
-
Thanks! I think I will give output buffering a shot, seems to be the simplest solution.
-
-
Thanks! Output bufferings seems to be the easiest solution, but ain't this an objection to the delayed output? Are there any other drawbacks? The Wire Render Pattern also looks pretty easy to understand and implement.
-
Hello! I dropped out on trying to use processwire, but I will give it a new try. So after reading some tuts (again) and much better understanding of the concept, there are of course new questions. I am using the latest pw 3.0 and the intermediate profile, so it is "delayed output" for me. My first question is how to output all the fields in a page? (Ryans planet tutorial) When I use $content=$page->planet_summary; then I get the content of this field. But how to output the fields "planet_age" and "planet_type" in the template file "planet.php"? So, I did some research and found "How to Create an AJAX Driven Theme for ProcessWire". Ok, let's concatenate the fields: $content=$page->planet_age . "<br/>" . $page->planet_type . "<br/>" . $page->planet_summary; So far so good, all is fine and working. But what to do when I use let's say 50 fields? There has to be a better method, also to arrange the fields with e.g. bootstrap. How can I do this?