Jump to content

Search the Community

Showing results for tags 'dry'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development


There are no results to display.

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL







Found 2 results

  1. Hello, I am loving using _init.php to set stuff up and keep some constant info DRY. However I think I ran into a situation while I was working with Form Builder where I was (legally/sensibly) editing a file the Module uses to send emails and cheerfully went about referring to a var that I knew I had established in _init.php only to find it was not being found. I quickly realized this was because the file in question was not a regular PW Template file (but a Form Builder support file). But it left me wondering which is the best approach for globally defining vars: set them all in config.php so I am guaranteed that from *any* file I can access them by `wire("config")->myVar` set them all in _init.php and for those I can't access in rare cases like Form Builder files do something special like for those vars define them in config.php and have _init.php set a var so all normal Templates can access the same way set them all in config.php then in _init.php read them all from config.php and re-declare them as named vars (i.e. same as 2. but for all vars not just those that are needed by non-Template files)? I'm leaning toward 3. but any thoughts (particularly to do with not wanting to inadvertently bog down PW by doing something silly) would be most appreciated.
  2. alan

    DRY URLs

    Hi PWers, Have you any good ideas about how a DRY (don't repeat yourself) store of URLs could be built for subsequent use within copy? The aim being that should a URL need to be changed it could be edited in the one DRY-location and all instances of it would therefore remain correct. My idea so far is to have a utility section (not for display) such as /utils/drys/ with a URL per page /utils/drys/my-first-dry-link /utils/drys/another-dry-link each URL-page would use a template with two fields, the Title for the default copy the link would use and another field to hold the URL. Then to use the link when editing content in TinyMCE one would need to switch to HTML view and insert some PHP+PW code to refer to the link {is this even possible?}. In a perfect world I would love to be able to swipe text in TinyMCE and the pop-up list of link options include something like "The URL field from this [drop-down menu] page" and what was inserted was a PHP+PW snippet that ensured that in future when the source URL is edited each use of this link will use the new URL. Cheers to anyone with any comments -Alan
  • Create New...