Module: MarkupBrowserUpdate

10 posts in this topic

So here i'm starting.

This is more a little snippet than a whole module.

On frontend before the </body> tag the script from

is working - nothing fancy here.

Download Github:

my todo for this is:

  • make it a clean module
  • make use of the settings from so you could define these in PW backend
  • get the backling for PW

best regards mr-fan

Edited by mr-fan
6 people like this

Share this post

Link to post
Share on other sites

So first question from a module newbee...

1. on installation a message is shown "session module unknown"

so where is the issue here -  naming?

Share this post

Link to post
Share on other sites

Just an note: It's adding the script AFTER the </body>

1 person likes this

Share this post

Link to post
Share on other sites

Since i was always on the road this week......this i just glued fast together....refactor the whole thing this weekend!

Thanks for your notice!

Share this post

Link to post
Share on other sites

Here we are with the first "real" version.

First post edited.

Name was changed in the right manner i think since it changes Markup it is a MarkupModule so no name confrontation with the HelloWorld modules on this front.

@MOD/ADMIN please change the name of this topic to

Module: MarkupBrowserUpdate ..cleared

thank you

Please test if you like the module.

I'll try to get a backlink from for PW.

regards mr-fan

Share this post

Link to post
Share on other sites


In this case checking for the template should be enough as everything you navigate to in the backend is most likely a process module with the admin template (I'm not aware of any exceptions). It's only if you call pages by the api where you need to check by has_parent. E.g. when you edit an user the users page is of the template user, but the rendered page is actually an admin template with the module ProcessUser running. So you're not accessing other templates directly, but through process modules.

2 people like this

Share this post

Link to post
Share on other sites

i'd take this line from the hello world i think it will do the job.

....i wouldn't name this a "real" simple hook and some configurationfields but with PW fortunately it is so simple...;)

But it is a good exercise to start with easy tasks....and if i've luck we get a backlink from for PW!

But it is a good exercise to start with easy tasks....and if i've luck we get a backlink from for PW!

just looked into github....and found

2 people like this

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By VirtuallyCreative
      Hello PW Community,
      I'm trying to modify a small module I found to pull in Gravatars but I'm having a bit of an issue and was curious if someone has already done a Gravatar implementation, or could look over the module code? It installed no problem, but when I try to use it, nothing works.
      Here is the full module:
      <?php /** * Module for generating Gravatar URLs for ProcessWire users. * * Use it like this: * * Get URL only with all defaults: * $user->gravatar() * * Get image tag with different size: * $user->gravatar(array('img' => true, 's' => 200)); * */ class Gravatar extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Gravatar', 'version' => 1, 'summary' => 'Gravatar hook for users', 'singular' => true, 'autoload' => true, 'icon' => 'smile-o', ); } public function init() { $this->addHook('User::gravatar', $this, 'methodGravatar'); } public function methodGravatar($event) { $u = $event->object; if ( ! $u instanceof User) $event->return = false; return; if ( ! $u->email) $event->return = false; return; $params = ($event->arguments(0) ? $event->arguments(0) : array()); // Default options $defaults = array( 's' => 100, 'd' => 'retro', 'r' => 'g', 'img' => false, 'attrs' => array(), ); $opts = array_merge($defaults, $params); extract($opts); $url = '//'; $url .= md5(strtolower(trim($u->email))); $url .= "?s=$s&d=$d&r=$r"; if ($img) { $url = '<img src="' . $url . '"'; foreach ($attrs as $key => $val ) { $url .= ' ' . $key . '="' . $val . '"'; } $url .= ' />'; } $event->return = $url; } } The issue is when I use $user->gravatar() I'm getting back "unknown". I know that the email being used by the current logged-in user (me) does have a Gravatar, but I'm unable to get the URL so I can place it into my template markup.
      Any insight or direction would be appreciated. I did a search for Gravatar modules / forum topics but it mostly appears to be linked to the Blog profile that uses Gravatar, not a stand-alone module / implementation.
    • By cosmicsafari
      Hi All,
      Fairly new to ProcessWire so apologies if this is a daft question, but I am having a go creating my first module. I have set it up and enabled it as per the docs.
      However I have created another class within the same module directory, which was going to be used in the main module file but I can't get it to work for the life of me and I believe its due to me not fully understanding the namespace side of things.
      <?php namespace ProcessWire; class MyModule extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Test Module', 'version' => 1, 'summary' => 'Test module', 'href' => '', 'singular' => true, 'autoload' => true, 'icon' => 'exchange', ); } public function newMethod( $testMessage ) { $foo = new Foo($testMessage); $foo->getFoo(); } } Foo.php
      <?php namespace ProcessWire; class Foo { protected $foo; public function __construct($foo) { $this->foo = $foo; } public function getFoo() { return $this->foo; } } Now as I understand it both these files should exist under the ProcessWire namespace, so in theory I should be able to use Foo within MyModule without any use statements as they both exist at the same level within the ProcessWire namespace?
      However when I try something like so:
      $myModule = $modules->getModule('MyModule'); $myModule->myMethod('Foo'); I would have thought this should return 'Foo', however I keep running into errors like:
      Any help would be appreciated.
    • By Max Allan Niklasson
      Hi, I think this is my first topic, even though I've been working with PW a few years. But now, I'm trying to restructure my way of coding, cause many templates (like activities for birding societies) are re appearing in multiple different websites. Since this, I've been working on redo this into a module, but as far as I have read I cannot store the templates (related to specific module) in the module's folder. It has to be in the templates folder?
    • By kongondo
      Menu Builder
      Modules Directory
      Project Page
      Read Me (How to install, use, etc..)

      If you want a navigation that mirrors your ProcessWire page tree, the system allows you to easily create recursive menus using either vanilla PHP or Soma's great MarkupSimpleNavigation. In some cases, however, you may wish to create menus that:
      1. Do not mirror you site's page tree (hirarchies and ancestry); and
      2. You can add custom links (external to your site) to.

      That is primarily where Menu Builder comes in. It is also helpful if you:
      3. Prefer creating menus via drag and drop
      4. Have a need for menus (or other listings) that will be changing regularly or that you want to allow your admin users to edit.

      The issue of custom menus is not new here in the forums. The difference is that this module allows you to easily create such menus via drag and drop in the Admin. Actually, you can even use it to just create some list if you wanted to. In the backend, the module uses the jQueryUI plugin nestedSortable by Manuele J Sarfatti for the drag and drop and is inspired in part by the WP Custom Menu feature.
      Please read the Read Me completely before using this module. 
      For Complex or highly-customised menus, it is recommended to use the getMenuItems() method as detailed in this post.
      Ability to create menus that do not mirror your ProcessWire Page Tree hierarchy/structure Menus can contain both ProcessWire pages and custom links Create menu hierarchies and nesting via drag and drop Easily add CSS IDs and Classes to each menu item on creating the menu items (both custom and from ProcessWire pages) or post creation. Optionally set custom links to open in a new tab Change menu item titles built from ProcessWire pages (without affecting the original page). E.g. if you have a page titled 'About Us' but you want the menu item title to be 'About' Readily view the structure and settings for each menu item Menus stored as pages (note: just the menu, not the items!) Menu items stored as JSON in a field in the menu pages (empty values not stored) Add menu items from ProcessWire pages using page fields (option to choose between PageAutocomplete and AsmSelect [default]) or a Selector (e.g. template=basic-page, limit=20, sort=title). For page fields, you can specify a selector to return only those specified pages for selection in the page field (i.e. asm and autocomplete) For superusers, optionally allow markup in your menu titles, e.g. <span>About</span> Menu settings for nestedSortable - e.g. maxLevels (limit nesting levels) Advanced features (e.g. add pages via selector, menu settings) currently permissible to superadmins only (may change to be permission-based) Delete single or all menu items without deleting the menu itself Lock down menus for editing Highly configurable MarkupMenuBuilder - e.g. can pass menu id, title, name or array to render(); Passing an array means you can conditionally manipulate it before rendering, e.g. make certain menu branches visible only to certain users [the code is up to you!]  Optionally grab menu items only (as a Menu object WireArray or a normal array) and use your own code to create custom highly complex menus to meet any need. More... In the backend, ProcessMenuBuilder does the menu creation. For the frontend, menus are displayed using MarkupMenuBuilder.


      In this module's infancy (way back!), I wanted to know more about ProcessWire modules as well as improve my PHP skills. As they say, what better way to learn than to actually create something? So, I developed this module (instead of writing PW tutorials as promised, tsk, tsk, naughty, naughty!) in my own summer of code . Props to Wanze, Soma, Pete, Antti and Ryan whose modules I studied (read copied ) to help in my module development and to Teppo for his wonderful write-up on the "Anatomy of fields in ProcessWire" that vastly improved my knowledge and understanding of how PW works. Diogo and marcus for idea about using pages (rather than a custom db table), onjegolders for his helpful UI comments, Martijn Geerts, OrganizedFellow, dazzyweb and Mike Anthony for 'pushing me' to complete this module and netcarver for help with the code.