Jump to content

Recommended Posts

On 1/28/2019 at 10:18 PM, kongondo said:

@besrwordt,

Do you have a current Media Manager subscription? makeBlankItem() is implemented in the latest Media Manager (version 012, soon coming out of beta). However, you can still import from one MM field to another. A MM field behaves like PageArrays (WireArrays).  

Yes i have. Will try that for sure!

A Media Manager field stores only two pieces of data; the (page) ID of the media being referenced and the media type (1=audio; 2=document; 3=image; 4=video; 3x=image variation). There's two ways you can go about exporting/importing from one field to the other. The second way is easiest if you need to import everything from one field to another, no questions asked. The first method allows fine control, e.g. if you want to skip certain media types. In the examples below, media_export is the Media Manager field with the media you want to copy over/merge with a second Media Manager field. media_import is the second Media Manager field into which media is being imported/copied over.

Method One: Loop through each media in the Media Manager field you are exporting from


// page with mm field we are importing into (media_import)
$p = $pages->get(1234);

// page with mm field we are exporting from (media_export)
foreach ($page->media_export as $m ) {
    // @note: here you can skip media you don't want to export
    // instance of new MediaManager()
    $mm = new MediaManager();
    // populate the MediaManager object properties with required data (media id and type)
    $mm->id = $m->id;
    $mm->type = $m->type;
    // import/add the media to the 2nd mm field (media_import)
    $p->media_import->add($mm);
}

// output formatting of
$p->of(false);
// save only the media manager field (page with import mm field)
$p->save('media_import');
// revert output formatting back on
$p->of(true);

 

Method Two: Import everything at once


// page with mm field we are importing into (media_import)
$p = $pages->get(1234);
// import all the media in the 1st mm field (media_export) into the 2nd mm field (media_import)
$p->media_import->import($page->media_export);
// output formatting of
$p->of(false);
// save only the media manager field (page with import mm field)
$p->save('media_import');
// revert output formatting back on
$p->of(true);

 

Note that all WireArray behaviour apply. For instance, you might want to first experiment in cases where your 2nd Media Manager field (media_import) already has some media which may or may not be present in the first Media Manager field. 

Great, Thanks!!!

 

Share this post


Link to post
Share on other sites

We've been experimenting with the v12 beta and have mostly had success with the new version.  We recently ran into a problem where the upload stopped working.  We can still upload via ftp and the "scan" function.  This is error that Tracy reports immediately after the files are uploaded.  We tried refreshing the module, but no go. 

MM-v12-error.png

Share this post


Link to post
Share on other sites
12 hours ago, Karinne Cyphers said:

We recently ran into a problem where the upload stopped working.  We can still upload via ftp and the "scan" function.  This is error that Tracy reports immediately after the files are uploaded.  We tried refreshing the module, but no go. 

Thanks for testing. The error says means that the media has not been found. It means that the media field is empty, for some reason, which is strange. The line where the error occurs tells me that in your settings you specify that uploading a duplicate media should replace the one that already exists in the Media Manager Library. Using these settings, I have tried to replicate the error that you are getting but everything works fine. The old media is replaced fine. Could you please provide more details? 

  1. What sort of media are you getting the error with? E.g. images
  2. If images, are they huge images?
  3. ProcessWire + PHP Versions
  4. What upload mode are you using? I've tried with both 'upload anywhere' on and off and I get no errors.
  5. It could be that you had an unfinished upload (maybe PHP ran out of memory). Could this be the case?

I have modified the file where the error is occurring to at least suppress the error. I've emailed it to you.

Share this post


Link to post
Share on other sites

Yes, what is strange is that the upload functionality was working fine, then it stopped working and began throwing those two errors.  Here are the details:

  1. Some media is a couple of megapixels, but the majority are things like icons and small graphics that are under 100kb, mostly imagees
  2. Most of the images are under 1mb and most are under 100kb
  3. Processwire 3.0.123 and PHP 7.3.x running as FPM
  4. We have upload anywhere turned on, but most of the uploads are done via the Media Manager itself
  5. The servers are virtualized but we have 256mb dedicated to PHP

We'll try to use the file you sent to see if suppressing helps the error.

Share this post


Link to post
Share on other sites
10 hours ago, Karinne Cyphers said:

Yes, what is strange is that the upload functionality was working fine, then it stopped working and began throwing those two errors. 

My bet is that there's an upload that didn't get completed and/or a media that, for some reason, did not get deleted and the process is stuck in memory.  Is it possible to try the following for me please?

  1. If you change the setting for "replacing duplicate media", to either "skip" or "rename" the uploaded media, does normal uploading work?
  2. With the setting back to "replace duplicate media", are you able to narrow down what particular image(s) leads to the errors? For instance, the error always occurs when you try to "upload and replace" a media called "Cats". We can then visit the "Cats" media page to edit it and see if there are any errors there.
  3. Are you able to edit your media pages to confirm that they all have images (i.e. they are not empty)?
  4. Are the images JPGs or PNGs or both?

Share this post


Link to post
Share on other sites

Well, it's strange... we toggled the replace duplicate media and gave it a go and now it is working again.  I set it back to confirm overwrite and it is still working.  This may be related to some other server issues we've been having, but our server guy has been making some adjustments to the environments today as well so that may have also had an impact.  Thank for your help with this!

Share this post


Link to post
Share on other sites

One other quick question, is there a configurable option to change the number of items returned?  I think by default it is set to 30, but is there an easy place we can change that?  Our content team has started to give us feedback and this was at the top of their list.

Share this post


Link to post
Share on other sites
9 hours ago, Karinne Cyphers said:

Thank for your help with this!

Glad you got it sorted :-).

 

9 hours ago, Karinne Cyphers said:

One other quick question, is there a configurable option to change the number of items returned?  I think by default it is set to 30, but is there an easy place we can change that?  Our content team has started to give us feedback and this was at the top of their list.

Yes. You can change the limit and lots of other similar stuff by using the filters under "What media to show". You can also configure and save a filter to be used as the default. Results can be filtered by a single or multiple criteria such as limit, title, description, tags, published, modified, etc. You can use operators such as contains text, equals, etc. The results are automatically refreshed when a filter is applied. Please see the two examples below. The first involves filtering the results directly without creating and saving the filter, although the filter will be cached and applied until the cache expires. The second one shows you how to create and save a filter that you can subsequently set as your default filter. This is especially useful if you are working in teams that need results tailored to their workflow. Please note that you may at times need to reset (rather than refresh) filters for a new one to apply due to caching. Although you can clear this type of filter directly, subsequent reloads with reload the filter as well. Hence, this type of filter persists across sessions. In the "What media to show" panel, the reset icon is the second one after the filters tab. The first icon is for refresh.

Direct Filter

 

media-manager-limit.thumb.gif.0ebf863d0f28b4a60f1a0ae5c6d7bb44.gif

 

Configure, Save and Apply Filter

In this example, we classify a number of items using a common tag, 'people'. We then create a filter titled People which limits the results returned by number (2) and tag (people). Please note that you do not have to use tags if all you are interested in is limit. We only use it to enrich the example. Finally, we set People as the default filter.  As a by  the way, you can also use tags to filter items in the frontend using a ProcessWire selector 🙂

media-manager-limit-filter.thumb.gif.aa2921d3ce8f713c151e30c3ce49c4a2.gif

  • Like 1

Share this post


Link to post
Share on other sites

Hi @kongondo,

we've discovered a strange behaviour of Media Manager upload (v 011): If the file extension is uppercase, i.e. "JPG", then the upload fails, despite "jpg" is set as valid image extension in settings. We've tried to add "JPG" (in uppercase) to the valid image extensions, but with no luck. The solution was finally to bulk rename all the files to lowercase jpg extension on a local device.

Have you ever heart of this beaviour? From my programmers view, I would assume, that the file extension check is case insensitive, but it isn't?

Greetings,

Thomas.

Share this post


Link to post
Share on other sites

HI @xportde

 

24 minutes ago, xportde said:

we've discovered a strange behaviour of Media Manager upload (v 011): If the file extension is uppercase, i.e. "JPG", then the upload fails, despite "jpg" is set as valid image extension in settings. We've tried to add "JPG" (in uppercase) to the valid image extensions, but with no luck. The solution was finally to bulk rename all the files to lowercase jpg extension on a local device.

Have you ever heart of this beaviour?

I'm not sure what's going on in your install :-). I've never experienced this behaviour before nor have I ever received a report about it. Just to be double sure, I've just now tested (MM 011; JFU 006) with an image with a .JPG extension and it is uploaded just fine. Any error shown? 

Share this post


Link to post
Share on other sites

Hi @kongondo,

this is very curious, indeed! So, if you never heart of this before, and it not seems to be a general problem, we will ask our customer not to use uppercased file extensions.

Thank you for your clarification!

Greetings,

Thomas.

Share this post


Link to post
Share on other sites
4 minutes ago, xportde said:

So, if you never heart of this before, and it not seems to be a general problem, we will ask our customer not to use uppercased file extensions.

What's their server environment? Are they on Windows? 

Edited by kongondo

Share this post


Link to post
Share on other sites

Hi @kongondo,

we've tested your new MM 012, great work!

In grid view, there is a small bug in rendering thumbnails: If the calculated width is not a whole number, the style of the elements div.mm_page_thumb is written as "width: 263,5px" for example. Because browsers expect decimal numbers in CSS with a dot, they fail in case of the comma, so the width is undefined and the thumbnail is not shown (see screenshot).

This error probably only occurs in german environments, where the decimal point is the comma by default.

I've changed line 524 in MediaManagerRenderer.php, what fixed the problem:

$wrapperWidth =  str_replace(',', '.', $media->thumbWidth) . 'px';

Alternatively, rounding the thumb width will have the same effect, because the decimal part isn't really important on rendering.

Greetings,

Thomas.

Screenshot MM 012 Grid View.jpg

  • Like 2

Share this post


Link to post
Share on other sites
Posted (edited)
On 5/8/2019 at 2:38 PM, xportde said:

In grid view, there is a small bug in rendering thumbnails: If the calculated width is not a whole number, the style of the elements div.mm_page_thumb is written as "width: 263,5px" for example. Because browsers expect decimal numbers in CSS with a dot, they fail in case of the comma, so the width is undefined and the thumbnail is not shown (see screenshot).

This error probably only occurs in german environments, where the decimal point is the comma by default.

Excellent find! You've saved me some debugging headache, thanks :-). A user reported missing images in grid view (table view was fine) and I couldn't figure out what was going on (I didn't have access to that site) but it was also a German user :-). 

Fixed in the release version (012). Please see post below.

Edited by kongondo

Share this post


Link to post
Share on other sites

Media Manager version 012  (released 10/05/2019)

Happy to announce the latest release of Media Manager.

Changelog

  1. ProcessWire 3.x support only.
  2. New GUI to match AdminThemeUiKit
  3. Upload Anywhere (drag and drop to upload in Media Manager Library and Media Manager Inputfields).
  4. Custom fields/columns - add any field to any of the Media Manager templates and access them as a property of a MediaManager object.
  5. Edit a single media including its custom fields

I would like to thank all the beta testers!

Documentation

Documentation is now complete! Please report any missing links or anything that is not clear.

Upgrading

  1. Grab the latest version of JqueryFileUpload (version 008) from here. Upgrade to that version (note: it is also namespaced)
  2. Grab the latest version of Media Manager using resend download links form here. Simply overwrite existing files but delete the files MediaManagerTabs.php and pocketgrid.css in the old files. Hit module refresh.

You might need to clear compiled files several times.

For most beta testers, upgrading has gone smoothly. However, two people have reported an error about class ProcessMediaManager not found in line 20 of MediaManagerUtilities. I have not been able to resolve this issue. I suspect FileCompiler is trying to be clever or some module loading order change?

Please let me know how it goes.

Beta testers, please upgrade as well. A few things have changed including a fix for the bug reported in the previous post.

Screenshots

media-manager.thumb.jpg.5b8aa9d4cc13f0638f5eb2d1c9f74f5c.jpg

Please refer to the documentation for more photos.

Thanks!

  • Like 3
  • Thanks 1

Share this post


Link to post
Share on other sites

Hi @kongondo,

For one of our customers, some pages of the MediaManager image view are not shown, because they contain some too big original images. Referring to this, in error protocol is written the well-known "Allowed memory size of .. bytes exhausted"-message, but we can't find out, what specific image is causing this.

Have you any idea to identify the problematic images?

Best regards,

Thomas.

Share this post


Link to post
Share on other sites
23 hours ago, xportde said:

For one of our customers, some pages of the MediaManager image view are not shown, because they contain some too big original images. Referring to this, in error protocol is written the well-known "Allowed memory size of .. bytes exhausted"-message, but we can't find out, what specific image is causing this.

Oh, oh. Someone forgot to set limits to upload sizes and/or client-side image resizing 😬😀.

23 hours ago, xportde said:

Have you any idea to identify the problematic images?

Good question. I'm not sure whether the code below will work. I don't know whether such images are counted by ProcessWire as uploaded or it is just their resizing that is an issue. I don't have a test image to use but try the below please in a Tracy console and let me know. It is just checking for empties. If it doesn't work maybe we can search by image size (0x260) instead.

$empties = $pages->find("template=media-manager-image,media_manager_image.count=0");
d($empties,'EMPTIES');

 

Share this post


Link to post
Share on other sites

I hope you don't mind me giving a little constructive feedback, it's going to be a bit critical but it's just an aspect that I think is being overlooked in an otherwise excellent module.

I think one thing that is holding me back from embracing this media manager (actually, we bought this in the past and then never used it -- and this is because there's no demo available) is that it really needs a little love in the styling department.

Nothing fancy, but -- if we look at the screenshot above we can see just general CSS issues, alignment of the filter label top right, checkbox and sort icons are too close to the sort options, a lot of negative space between the filters and the nav, image count is too big and not aligned with pagination opposite. The spacing also between the types of media along the top is also not right when compared to how the CMS typically spaces out horizontal navigation. This is just in one screenshot, but these issues persist throughout in various places, such as notifications, upload boxes etc.

Considering we have the UIKit CMS theme to base everything off, this kind of thing means that the media manager feels out of place in an otherwise quite neatly organised CMS.

Now, people using this media manager for their personal projects will not care about these things, they will roll their eyes and say "why should we care, it's the back-end of the site, only functionality matters" (and in this, I must reiterate, you have done an outstanding job), however if I am building a CMS and handing it over to someone else, I need all aspects to have a consistency in quality because that is reassuring to clients.

  • Like 2

Share this post


Link to post
Share on other sites
24 minutes ago, cjx2240 said:

I hope you don't mind me giving a little constructive feedback

Not at all :-). Thanks for the feedback. I value such feedback.

24 minutes ago, cjx2240 said:

and this is because there's no demo available

Actually there is/was...but it is outdated. I can look into this. Meanwhile, one can always test and request a refund if they are not satisfied with the product :-). 

24 minutes ago, cjx2240 said:

Now, people using this media manager for their personal projects will not care about these things, they will roll their eyes and say "why should we care, it's the back-end of the site, only functionality matters" (and in this, I must reiterate, you have done an outstanding job), however if I am building a CMS and handing it over to someone else, I need all aspects to have a consistency in quality because that is reassuring to clients.

Agreed. The thing that confuses me though is that we have hundreds of people using Media Manager, for client projects, some quite big (working with Hollywood; +500K images, etc) but not a single person has ever mentioned design issues. I am not saying this translates to no issues but a I am a bit curious why no one else has raised such issues.

Thanks.

Share this post


Link to post
Share on other sites
39 minutes ago, kongondo said:

Agreed. The thing that confuses me though is that we have hundreds of people using Media Manager, for client projects, some quite big (working with Hollywood; +500K images, etc) but not a single person has ever mentioned design issues. I am not saying this translates to no issues but a I am a bit curious why no one else has raised such issues.

I can only speak for myself. But I feel the same way. I bought the Media Manager, but never used it. Once I used it in a customer project, I had feedback from the customers that the visualization and usability was not good for them. Personally, I'm also a little bothered by that. Why have I never submitted this as a suggestion for improvement? You know: laziness. I always had the hope that others would do it and that there would be an update at some point. 😄 

  • Like 2

Share this post


Link to post
Share on other sites
7 minutes ago, David Karich said:

Once I used it in a customer project, I had feedback from the customers that the visualization and usability was not good for them.

Thanks for the feedback. Was this an older version or the latest (012)?

Share this post


Link to post
Share on other sites
4 minutes ago, kongondo said:

Thanks for the feedback. Was this an older version or the latest (012)?

To be fair, the last version I worked with is 011. Of course there have been some changes with the new version, but optically I see some deficits as well. Apropos: I never received a download link for the update to 012 by mail. Or do I have to buy a new license?

Share this post


Link to post
Share on other sites
13 minutes ago, kongondo said:

Thanks for the feedback. Was this an older version or the latest (012)?

I can also tell you what bothered her the most, besides the visual component. My customers like to think in folders. They would like to click through a tree and categorize the data into folders. As PW itself is structured. Because the biggest problem here again is laziness itself. If you upload a picture and don't immediately describe and tag it properly, later searching becomes difficult. And my customers are all hectic and have no time for that. 😄 

Share this post


Link to post
Share on other sites
1 hour ago, kongondo said:

Agreed. The thing that confuses me though is that we have hundreds of people using Media Manager, for client projects, some quite big (working with Hollywood; +500K images, etc) but not a single person has ever mentioned design issues.

@kongondo Good to know (+500k), do they use $config->pagefileExtendedPaths, an unlimited file system or are there special features of the Media Manager for storing the images?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Robin S
      Repeater Images
      Adds options to modify Repeater fields to make them convenient for "page-per-image" usage. Using a page-per-image approach allows for additional fields to be associated with each image, to record things such as photographer, date, license, links, etc.
      When Repeater Images is enabled for a Repeater field the module changes the appearance of the Repeater inputfield to be similar (but not identical) to an Images field. The collapsed view shows a thumbnail for each Repeater item, and items can be expanded for field editing.
      Screencast

      Installation
      Install the Repeater Images module.
      Setup
      Create an image field to use in the Repeater field. Recommended settings for the image field are "Maximum files allowed" set to 1 and "Formatted value" set to "Single item (null if empty)". Create a Repeater field. Add the image field to the Repeater. If you want additional fields in the Repeater create and add these also. Repeater Images configuration
      Tick the "Activate Repeater Images for this Repeater field" checkbox. In the "Image field within Repeater" dropdown select the single image field. You must save the Repeater field settings to see any newly added Image fields in the dropdown. Adjust the image thumbnail height if you want (unlike the core Images field there is no slider to change thumbnail height within Page Edit). Note: the depth option for Repeater fields is not compatible with the Repeater Images module.
      Image uploads feature
      There is a checkbox to activate image uploads. This feature allows users to quickly and easily add images to the Repeater Images field by uploading them to an adjacent "upload" field.
      To use this feature you must add the image field selected in the Repeater Images config to the template of the page containing the Repeater Images field - immediately above or below the Repeater Images field would be a good position.
      It's recommended to set the label for this field in template context to "Upload images" or similar, and set the visibility of the field to "Closed" so that it takes up less room when it's not being used. Note that when you drag images to a closed Images field it will automatically open. You don't need to worry about the "Maximum files allowed" setting because the Repeater Images module overrides this for the upload field.
      New Repeater items will be created from the images uploaded to the upload field when the page is saved. The user can add descriptions and tags to the images while they are still in the upload field and these will be retained in the Repeater items. Images are automatically deleted from the upload field when the page is saved.
      Tips
      The "Use accordion mode?" option in the Repeater field settings is useful for keeping the inputfield compact, with only one image item open for editing at a time. The "Repeater item labels" setting determines what is shown in the thumbnail overlay on hover. Example for an image field named "image": {image.basename} ({image.width}x{image.height})  
      https://github.com/Toutouwai/RepeaterImages
      https://modules.processwire.com/modules/repeater-images/
    • By EyeDentify
      Hello There Guys.

      I am in the process of getting into making my first modules for PW and i had a question for you PHP and PW gurus in here.

      I was wondering how i could use an external library, lets say TwitterOAuth in my PW module.
      Link to library
      https://twitteroauth.com/

      Would the code below be correct or how would i go about this:
      <?PHP namespace ProcessWire; /* load the TwitterOAuth library from my Module folder */ require "twitteroauth/autoload.php"; use Abraham\TwitterOAuth\TwitterOAuth; class EyeTwitter extends WireData,TwitterOAuth implements Module { /* vars */ protected $twConnection; /* extend parent TwitterOAuth contructor $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token, $access_token_secret); */ public function myTwitterConnection ($consumer_key, $consumer_secret, $access_token, $access_token_secret) { /* save the connection for use later */ $this->twConnection = TwitterOAuth::__construct($consumer_key, $consumer_secret, $access_token, $access_token_secret); } } ?> Am i on the right trail here or i am barking up the wrong tree?
      I don´t need a complete solution, i just wonder if i am including the external library the right way.
      If not, then give me a few hint´s and i will figure it out.

      Thanks a bunch.

      /EyeDentify
    • By dimitrios
      Hello,
      this module can publish content of a Processwire page on a Facebook page, triggered by saving the Processwire page.
      To set it up, configure the module with a Facebook app ID, secret and a Page ID. Following is additional configuration on Facebook for developers:
      Minimum Required Facebook App configuration:
      on Settings -> Basics, provide the App Domains, provide the Site URL, on Settings -> Advanced, set the API version (has been tested up to v3.3), add Product: Facebook Login, on Facebook Login -> Settings, set Client OAuth Login: Yes, set Web OAuth Login: Yes, set Enforce HTTPS: Yes, add "http://www.example.com/processwire/page/" to field Valid OAuth Redirect URIs. This module is configurable as follows:
      Templates: posts can take place only for pages with the defined templates. On/Off switch: specify a checkbox field that will not allow the post if checked. Specify a message and/or an image for the post.
      Usage
      edit the desired PW page and save; it will post right after the initial Facebook log in and permission granting. After that, an access token is kept.
       
      Download
      PW module directory: http://modules.processwire.com/modules/auto-fb-post/ Github: https://github.com/kastrind/AutoFbPost   Note: Facebook SDK for PHP is utilized.


    • By kongondo
      FieldtypeRuntimeMarkup and InputfieldRuntimeMarkup
       
      Modules Directory: http://modules.processwire.com/modules/fieldtype-runtime-markup/
      GitHub: https://github.com/kongondo/FieldtypeRuntimeMarkup
      As of 11 May 2019 ProcessWire versions earlier than 3.x are not supported
      This module allows for custom markup to be dynamically (PHP) generated and output within a page's edit screen (in Admin).
       
      The value for the fieldtype is generated at runtime. No data is saved in the database. The accompanying InputfieldRuntimeMarkup is only used to render/display the markup in the page edit screen.
       
      The field's value is accessible from the ProcessWire API in the frontend like any other field, i.e. it has access to $page and $pages.
       
      The module was commissioned/sponsored by @Valan. Although there's certainly other ways to achieve what this module does, it offers a dynamic and flexible alternative to generating your own markup in a page's edit screen whilst also allowing access to that markup in the frontend. Thanks Valan!
       
      Warning/Consideration
      Although access to ProcessWire's Fields' admin pages is only available to Superusers, this Fieldtype will evaluate and run the custom PHP Code entered and saved in the field's settings (Details tab). Utmost care should therefore be taken in making sure your code does not perform any CRUD operations!! (unless of course that's intentional) The value for this fieldtype is generated at runtime and thus no data is stored in the database. This means that you cannot directly query a RuntimeMarkup field from $pages->find(). Usage and API
       
      Backend
      Enter your custom PHP snippet in the Details tab of your field (it is RECOMMENDED though that you use wireRenderFile() instead. See example below). Your code can be as simple or as complicated as you want as long as in the end you return a value that is not an array or an object or anything other than a string/integer.
       
      FieldtypeRuntimeMarkup has access to $page (the current page being edited/viewed) and $pages. 
       
      A very simple example.
      return 'Hello'; Simple example.
      return $page->title; Simple example with markup.
      return '<h2>' . $page->title . '</h2>'; Another simple example with markup.
      $out = '<h1>hello '; $out .= $page->title; $out .= '</h1>'; return $out; A more advanced example.
      $p = $pages->get('/about-us/')->child('sort=random'); return '<p>' . $p->title . '</p>'; An even more complex example.
      $str =''; if($page->name == 'about-us') { $p = $page->children->last(); $str = "<h2><a href='{$p->url}'>{$p->title}</a></h2>"; } else { $str = "<h2><a href='{$page->url}'>{$page->title}</a></h2>"; } return $str; Rather than type your code directly in the Details tab of the field, it is highly recommended that you placed all your code in an external file and call that file using the core wireRenderFile() method. Taking this approach means you will be able to edit your code in your favourite text editor. It also means you will be able to type more text without having to scroll. Editing the file is also easier than editing the field. To use this approach, simply do:
      return wireRenderFile('name-of-file');// file will be in /site/templates/ If using ProcessWire 3.x, you will need to use namespace as follows:
      return ProcessWire\wireRenderFile('name-of-file'); How to access the value of RuntimeMarkup in the frontend (our field is called 'runtime_markup')
       
      Access the field on the current page (just like any other field)
      echo $page->runtime_markup; Access the field on another page
      echo $pages->get('/about-us/')->runtime_markup; Screenshots
       
      Backend
       

       

       
      Frontend
       

×
×
  • Create New...