Jump to content

fliwatuet

Members
  • Posts

    29
  • Joined

  • Last visited

Posts posted by fliwatuet

  1. 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));

     

    • Like 2
  2. 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...

  3. @adrian here is what I did:

    1. Install the module and set Enable for process to  ProcessPageEdit, (Page Edit)
    2. Create two fields: street, city
    3. Add these two fields to the template basic-page and arrange them ahead the map marker field
    4. 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?

  4. 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.

  5. 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.

  6. 7 minutes ago, netcarver said:

    Does the page you are viewing using the home template actually have a value for the map field saved in it?

    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.

  7. 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.

  8. 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.

  9. 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.

     

  10. 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;
    }
    

     

  11. 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

    leafletmarkersource.png

    Is that the correct? It is the same problem as with the google map marker field :mellow:

  12. 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?

  13. Sorry. I did that last year, but forgot it meanwhile... ???

    I don't want to buy anything, the project is completely non-commercial.

    ---

    Ok. New page. I get this message:

    There are currently no templates with defined parent/child relationships needed to show "Add New" shortcuts here. To configure this, edit any template (Setup > Templates) and click on the "Family" tab.

    What am I supposed to do at Setup - Templates? Which template is the parent and which one is the child?

×
×
  • Create New...