Jump to content

gmclelland

Members
  • Posts

    566
  • Joined

  • Last visited

  • Days Won

    6

Posts posted by gmclelland

  1. Sorry to hear.  I use linode.com with https://serverpilot.io/ which allows you to switch php versions

    I'm using the similar TemplateEngineFactory and TemplateEngineTwig modules.

    Here is my cleanup-location-index.php

    Spoiler
    
    <?php namespace ProcessWire;
    
    $map = wire('modules')->get('MarkupLeafletMap');
    
    $cleanupLocations = $pages->find("template=cleanup-location, sort=sort");
    $view->set('cleanupLocations', $cleanupLocations);
    
    if(count($cleanupLocations)>0){
      // https://github.com/netcarver/PW-FieldtypeLeafletMapMarker
      $cleanupLocationsMap = $map->render($cleanupLocations, 'cleanup_location', array(
        'height' => '500px',
        'markerIcon' => 'thumb-tack',
        'markerColour' => 'green',
        'provider' => 'OpenStreetMap.Mapnik',
        'scrollWheelZoom' => 'false',
        'popupFormatter' => function($page) {
          $out[] = "<br/><a class=\"button button-primary\" href=\"$page->url\">Register Now</a>";
          return implode('<br/>', $out);
        }));
    }
    
    $view->set('cleanupLocationsMap', $cleanupLocationsMap);
    
    $leafletHeaderLines = $map->getLeafletMapHeaderLines();
    $view->set('leafletHeaderLines', $leafletHeaderLines );

     

    Here is my cleanup-location-index.twig

    Spoiler
    
    {% extends "./partials/one-column-layout.twig" %}
    
    {% block stylesheets %}
      {{ leafletHeaderLines }}
      {{ parent() }}
    {% endblock stylesheets %}
    
    {% block content %}
      {{ parent() }}
    
      {% if cleanupLocationsMap %}
        {{ cleanupLocationsMap }}
      {% endif %}
    {% endblock content %}
    
    {% block main2 %}
    <div class="row main2 expanded slice-padding">
      <div class="row">
        <div class="small-12 columns">
          <div class="row">
            <h2>Select a cleanup location</h2>
            {% for location in cleanupLocations %}
                <div class="callout callout-list-item-dol row collapse">
                    <div class="medium-10 columns">
    
                        <p><a class="callout-list-item-dol__title-link" href="{{ location.url }}">{{ location.title }}</a></p>
                    </div>
                    <div class="medium-2 columns">
                        <a class="button button-primary float-right" href="{{ location.url }}">View Details</a>
                    </div>
                </div>
            {% else %}
                <p>There are no cleanup locations for this event.</p>
            {% endfor %}
          </div>
        </div><!-- columns -->
      </div><!-- row -->
    </div><!-- row -->
    {% endblock main2 %}
    

     

    Hope that helps

  2. Do you have any initialization code included on the page?

    From my example site

    <script type="text/javascript">
    $(function() {
    var mleafletmap1 = new jsMarkupLeafletMap();
    mleafletmap1.setOption('zoom', 12);
    mleafletmap1.setOption('scrollWheelZoom', false);
    
    mleafletmap1.init('mleafletmap1', 32.5650134, -97.1253889, 'OpenStreetMap.Mapnik');
    var default_marker_icon = L.AwesomeMarkers.icon({ icon: 'thumb-tack', iconColor: 'white', prefix: 'fa', markerColor: 'green' });
    mleafletmap1.addMarkerIcon(default_marker_icon, 32.571438, -97.141617, '/cleanup-locations/cleanup-site-no.1-town-park/', 'Cleanup Site No.1 Town Park', '<br/><a class="button button-primary" href="/cleanup-locations/cleanup-site-no.1-town-park/">Register Now</a>');
    mleafletmap1.addMarkerIcon(default_marker_icon, 32.568825, -97.135254, '/cleanup-locations/cleanup-site-no.2-katherine-rose-memorial-park/', 'Cleanup Site No.2 Katherine Rose Memorial Park', '<br/><a class="button button-primary" href="/cleanup-locations/cleanup-site-no.2-katherine-rose-memorial-park/">Register Now</a>');
    mleafletmap1.addMarkerIcon(default_marker_icon, 32.568027, -97.134216, '/cleanup-locations/cleanup-site-no.3-hardy-allmon-soccer-complex/', 'Cleanup Site No.3 Hardy Allmon Soccer Complex', '<br/><a class="button button-primary" href="/cleanup-locations/cleanup-site-no.3-hardy-allmon-soccer-complex/">Register Now</a>');
    mleafletmap1.addMarkerIcon(default_marker_icon, 32.566681, -97.122604, '/cleanup-locations/cleanup-site-no.4-julian-field-serenity-gardens/', 'Cleanup Site No.4 Julian Field-Serenity Gardens', '<br/><a class="button button-primary" href="/cleanup-locations/cleanup-site-no.4-julian-field-serenity-gardens/">Register Now</a>');
    mleafletmap1.addMarkerIcon(default_marker_icon, 32.572479, -97.125290, '/cleanup-locations/cleanup-site-no.5-james-mcknight-park-west/', 'Cleanup Site No.5 James McKnight Park West', '<br/><a class="button button-primary" href="/cleanup-locations/cleanup-site-no.5-james-mcknight-park-west/">Register Now</a>');
    mleafletmap1.addMarkerIcon(default_marker_icon, 32.575569, -97.120041, '/cleanup-locations/cleanup-site-no.6-james-mcknight-park-east/', 'Cleanup Site No.6 James McKnight Park East', '<br/><a class="button button-primary" href="/cleanup-locations/cleanup-site-no.6-james-mcknight-park-east/">Register Now</a>');
    mleafletmap1.addMarkerIcon(default_marker_icon, 32.586960, -97.102921, '/cleanup-locations/cleanup-site-no.7-oliver-nature-park/', 'Cleanup Site No.7 Oliver Nature Park', '<br/><a class="button button-primary" href="/cleanup-locations/cleanup-site-no.7-oliver-nature-park/">Register Now</a>');
    mleafletmap1.addMarkerIcon(default_marker_icon, 32.582439, -97.128456, '/cleanup-locations/cleanup-site-no.8-hog-pen-branch/', 'Cleanup Site No.8 Hog Pen Branch', '<br/><a class="button button-primary" href="/cleanup-locations/cleanup-site-no.8-hog-pen-branch/">Register Now</a>');
    mleafletmap1.addMarkerIcon(default_marker_icon, 32.586273, -97.084381, '/cleanup-locations/cleanup-site-no.9-philip-thompson-soccer-complex/', 'Cleanup Site No.9 Philip Thompson Soccer Complex', '<br/><a class="button button-primary" href="/cleanup-locations/cleanup-site-no.9-philip-thompson-soccer-complex/">Register Now</a>');
    mleafletmap1.fitToMarkers();
    });
    </script>

     

  3. I also had some interest in setting up a living style guide with Patternlab and Processwire using the TemplateEngineFactory module and TemplateEngineTwig module.  I haven't gotten around to creating a custom module to add the twig namespaces.

    Here is where I explain the ideas behind it.  There seems to be a lot of talk about it right now in the Drupal community. 

     

  4. On 8/12/2017 at 4:19 AM, flydev said:

    Concretely, what is the bad thing about leaving all those SDKs file being "FileCompiled" ?

    Here's the documentation on that http://processwire.com/blog/posts/processwire-3.0.43-core-updates/#new-filecompiler-options

    Without the /*NoCompile*/ it would probably cause unneeded additional processing.  I think Processwire would also probably try to add namespaces to those third party libs which may cause random problems.

    The code above looks correct, I'm not sure why it is still compiling.

    • Like 1
  5. Not sure how to help you, but you might be better off creating a TemplateEngineMustache module that extends the TemplateEngineFactory module:

    There is already sub modules created that you could look at for other template engines like

    I personally use TemplateEngineFactory with TemplateEngineTwig.

    Hope that helps

    • Like 3
  6. @onjegolders Maybe you can try templates/views/ with the trailing slash?  Also like Wanze is saying you need a php controller file in /site/templates/ and you need a .twig file to go with it.  Ex. calendar-list.php and calendar-list.twig.

    In my .twig file I extend a base template with {% extends "./partials/one-column-layout.twig" %}.  I like to keep my php controller files in the same directory as my .twig files so that I don't have switch between directories so much.

    @Wanze Did you happen to see my post above?

     

  7. Hi @Wanze,

    I'm interested in somehow adding twig namespaces.  I'm not sure if it would be best to do this in a custom module via hooking initTwig, adding to this module, or the adding to the TwigExtensions module?

    The reason I'm interested in this is because I would like to use PatternLab(http://patternlab.io/) with Twig and Processwire.  Basically I would like to use my PatternLab components created with Twig and include them within my Processwire Twig templates.  The benefit is that you can have a styleguide that is always in sync with the website's templates.

    I would like to add something like @molecules, @organisms, and @atoms namespaces to specify what directory my Frontend twig components are located in.  The components usually live under the PatternLab's directory in your site/templates/Patternlab/source/_patterns folder.  This @styleguide namespace would allow me to easily change the paths to my components folders if they ever change.

    The new symfony.com also uses a @icons namespace to easily include svg icons.  http://symfony.com/blog/refactoring-symfony-com-front-end

    {# Twig namespaces create concise and beautiful templates #}
    <i class="icon">{{ source('@icons/arrow.svg') }}</i>

    For background reading of why to do this:

    Implementation

    I'm thinking I just need to add a textarea field that allows the user to enter a namespace and the path to the twig templates on a new line separated by a delimiter of some kind.  The markupSEO module doesn't this in it's config settings.

    To add the namespaces to Twig:

    According to https://twig.sensiolabs.org/doc/1.x/api.html, I think you can do the following:

    $loader->addPath($templateDir, 'admin');
    
    //adds an @admin namespace

    I would love to hear anyone's thoughts on this.  I really like working with Processwire and Twig, it really makes code so much cleaner and easier to read.

  8. I think I tried a quick test not to long ago to update the external libraries, and I believe I ran into the problem with the map not showing and javascript errors displayed in the console.  I haven't had any time to investigate further.

  9. Ok, I got it.  I deleted all the "repeater" references from the database and then uninstalled and reinstalled FieldtypeRepeater module without an error messages.  I then was able to add a new repeater field with the option of adding additional fields to the repeater.

    Thank you everyone for helping me out. 

  10. Yes, I mean one that I try to create via Setup > Fields > add new.  Not import.

    So I uninstalled the FieldtypeRepeater module and reinstalling it gives me this message " Session: Module reported error during install (FieldtypeRepeater): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'repeaters-2' for key 'name_parent_id'"

    I guess I now have to find where there is a duplicate row somewhere in my database that is causing the problem?

  11. Thanks @Robin S, good to know.  The main issue is that I can create a repeater field, but I can't add any additional fields to the repeater field.  It's missing the "Details" tab.

    When I edit the newly created repeater field, it shows the following message "Field: You must assign a template to the page before setting custom field values (title)"

    Any ideas as to what that could be?  I wonder how I screwed up repeater fields?  This is unfortunate because I was almost finished building the site when I had a need to use repeaters.

×
×
  • Create New...