Jump to content

Charming Troll

Members
  • Posts

    7
  • Joined

  • Last visited

Everything posted by Charming Troll

  1. Following is how I've got it working. I haven't done major testing yet, but it appears to be working. /site/init.php (at end of file) require_once('./classes/CommonTemplate.php'); /site/classes/CommonTemplate.php <?php namespace ProcessWire; class CommonTemplate extends Page { function __construct($templates = array(), $parents = array()) { parent::__construct($templates, $parents); } function testClass() { be("This is working!"); } } /site/classes/[TemplateName]Page.php (eg: AboutUsPage.php) <?php namespace ProcessWire; class AboutUsPage extends CommonTemplate { function test() { $this->testClass(); // Works! } } This way I'm able to access methods from "CommonTemplate" in custom page classes as $this->methodName() and in actual template files it works as wire()->methodName(). So, for clarity: /site/templates/about-us.php <?php namespace ProcessWire; ?> <h1>Cool Macho HTML template stuff</h1> <?php page()->testClass(); // or $page->testClass(); // or $this->page()->testClass(); // or $this->page->testClass(); ?>
  2. Has anyone seen or know of any documentation on the ProcessWire run cycle? I know TracyDebugger can really help but for me that's different than having a knowledge or picture in my mind of what gets processed in what order on most requests.
  3. If I'm not mistaken, this is the same thing I'm trying to do right now but it's not working. I'm currently trying to figure out the best way to load the base class and use it with others in classes. JayGee, do you mean something like: /site/classes/CommonTemplate.php <?php namespace ProcessWire; class CommonTemplate extends Page { function __construct() { be("CommonTemplate initialized"); } function somethingAllPagesCanUse() { be("common template methods"); } } Then for specific pages: /site/classes/ContactPage.php <?php namespace ProcessWire; class ContactPage extends CommonTemplate { function __construct() { be("Not working"); } } Just typed that on the fly, sorry if there's errors. ?
  4. Disclaimer: As someone new to PW, I wouldn't consider this an answer but a little help on moving forward. Check out the selector section of docs: Using selectors in ProcessWire CMS An example find - would get items that match River on the "parent" and items that match Dinner-Plated on the child. $results = $pages->find('template=venue-area|function-type, (function=River), (type=Dinner-Plated)'); There are endless possibilities with the selectors so that's just one way. Each result (say you're looping $result as $item) would have things like $item->parent, or $item->children. For example, you can do $item->parent->title. I don't know if you're using repeaters, page refs or any of the fields so the selectors could vary wildly. Either way, that selector page has a lot of great details. As for unwieldly results, hopefully a more seasoned person can add some guidance. It may be best to do more than one selector depending on the structure and complexity of searches. How many sections, search criteria and results are you expecting? As a parting note, I would strongly suggest you have Tracy Debugger installed > Tracy Debugger (TracyDebugger) - ProcessWire Module. The page dumps alone are lifesavers.
  5. Can anyone who's used it verify that the MarkupAdminDataTable module DOES NOT support colspan or rowspan? Looking through the repo I don't see any mention, code or way of doing it natively. Ref: MarkupAdminDataTable.module - GitHub Dev Branch In the meantime, I can modify the source or inject what I want with JS but neither feels great to me.
  6. So I just re-installed and copied the data as if moving a site. This is how I did it: 1) Reinstalled dev branch with blank template. 2) Reinstalled all the modules being used (core and third party). 3) Dumped old DB, deleted all system type tables (caches, modules, permissions, pass, etc.) and kept fields/templates/pages. Manually changed CKEditor fieldtype to TinyMCE. Imported to new database. 4) Copied /template dir. Copied /assets/files dir. Copied ready.php and updated the new config.php with some settings I had added. 5) I had to edit a few Admin pages to re-configure their Process items as I deleted that from DB. Seems to be working... I'll update if anything else was needed. Note: I didn't attempt to copy old logs or anything, so history is gone by doing it this way.
  7. I was noticing I didn't have TinyMCE as an option for textarea so figured I'd set it up. I try installing it and get an error "Compile Error: Cannot declare class ProcessWire\InputfieldTinyMCE, because the name is already in use (line 65 of ... InputfieldTinyMCE.module.php)" I've been working with and learning PW through this install so it's most likely something I did. I'm suspecting I tried to install it from the module repo. Maybe a cache/setting because I was trying to use the module but it's now in core? Could be another module I tried? So, anyone else seen this error and have a fix for it? Install Details: - Processwire 3.0222 dev (Updated today, through Git) - Started with blog / uikit template. - TinyMCE in modules is showing version is listing at 6.1.5 Core but description is showing 6.4.1 - Running on Laragon 6.0, php 8.1.10 Win x64 Tried: - Deleting TinyMCE directories in wire/site and grabbing them again from git. - Editing 6.1.5 version to 6.4.1 in mysql cache and modules. - Clear compiled modules multiple times throughout every change. - Deleting module from admin interface. - Removing directory from site but then get a "filemtime(): stat failed on InputfieldTinyMCE.module.php" - because obviously it's not there! ? Next Steps: - Take a bit of a break then look deeper into the caching stuff. Thanks for looking!
×
×
  • Create New...