Jump to content

adrian

PW-Moderators
  • Posts

    10,902
  • Joined

  • Last visited

  • Days Won

    349

Everything posted by adrian

  1. Not sure if it suits your needs or not, but: http://modules.processwire.com/modules/process-changelog/ Also, check out isChanged(): http://cheatsheet.processwire.com/?filter=ischanged
  2. Not sure if the first line of your first post is a question or a statement , but renderItem(): https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/modules/Fieldtype/FieldtypeComments/InputfieldCommentsAdmin.module#L33 and render(): https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/modules/Fieldtype/FieldtypeComments/InputfieldCommentsAdmin.module#L88 are hookable, so it shouldn't be too hard
  3. If I understand correctly, there is no need to hook - just don't use the built in render method, but instead generate the output yourself. http://processwire.com/api/fieldtypes/comments/ and scroll down to the "OPTIONAL: Generating your own output" section. Does that cover your needs?
  4. Hey Macrura - nice looking site! One minor thing - the navigation-divider.png looks a little weird to the right on the selected menu item. If I disable it, that little black line goes away and looks better. I understand it looks good between the unselected items, but it does look weird to the right of a selected one which is green. #navigation ul li a { display: inline-block; color: #fff; text-decoration: none; font-size: 13px; font-weight: 500; padding: 17px 25px; background: url(/site/templates/centum/images/navigation-divider.png) no-repeat right 50%;
  5. There is also this lorem ipsum module for PW: http://modules.processwire.com/modules/markup-loren-ipsum/
  6. You can't assign the parent like that - you need to provide a page object - something like: $p->parent = $pages->get("/blog/"); You should also get into the habit of setting outputformatting off before saving a page: $p->of(false); Correction - even though the above approach works just fine, apeisa's way of assigning the path to the page also works, so my comment about needing a page object is actually not correct!
  7. @Raul It looks like this module hasn't seen any updates in a long time and the author doesn't appear to have a forum account (under the cnsknight name anyway) and there is no official support thread for it. I think your only option might be to post an issue over at github and see if you get any response.
  8. You also might find this module by soma very useful: http://modules.processwire.com/modules/chrome-php-logger/ It logs lots of useful info to the console, including: "current page with all its fields and their value and field settings" I think this will be the easiest option for what I think you want.
  9. Wow - how did I miss (or maybe forget about) this - thanks That works perfectly! PS Sorry for hijacking your thread here @justb3a
  10. I was a little confused at first too and thought it might work to generate dynamic/conditional dropdowns like you are describing with the Europe countries example - actually that is a field type that I think would be nice - I have been thinking about it the last couple of days actually What this relation fieldtype does is create a dropdown field that lists the entries for the selected field from all the matched templates/pages. The option value is the ID of the page that has the entry. Clear as mud right Maybe you just need to try it
  11. Thanks for this - I think it will come in very handy. Just a quick note though - looks like you did a find/replace just before submitting, because there are several instances of "FieldField" instead of just "Field", eg. $chooseFieldField and instanceof FieldFieldtypeRepeater - this is preventing your attempts for excluding a bunch of field types from the list of available fields. PS I'd love to see support for Profields Table subfields
  12. Sorry - not sure what you mean here - changes from when till when? Sorry, now I think I am the one having the blonde moment
  13. Actually, I think you are right. Although there might need to be a slight variation on that, depending on the WP source format. I hadn't ever looked at the canonical link info, so knowing that is set up correctly, I guess we don't need to worry about those ID based links - guess there really isn't much to do afterall PS the "k" man beat me to moving this thread!
  14. Well it's just that WP URL's often have the date in the URL and there are a few different format options. Of course this could be replicated in PW, but typically it isn't, so I was mostly wanting to redirect from the pretty WP format to the PW format.
  15. Hey Mike - any thoughts of making is possible to add redirects via an API call. After the discussion this morning about imported Wordpress rewriting (https://processwire.com/talk/topic/8869-wordpress-url-rewrites/), I would like to add this functionality to MigratorWordpress so that rewrites are automatically added. Obviously I can do it through SQL inserts, but thought an API method would be nice.
  16. I am not sure on this, but I wonder if Page Path History can handle that URL format? Have you thought about using the Redirects module (http://modules.processwire.com/modules/process-redirects/) or the new Advance Redirects / Jumplinks (https://processwire.com/talk/topic/8697-alpha-processadvancedredirects/). I am also curious how you did your import. I am thinking of adding redirect support to the MigratorWordpress module (https://github.com/NicoKnoll/MigratorWordpress) and will probably use one of those two modules to do it. I would want to add both the ID based and SEO friendly WP links as redirects - any thoughts?
  17. Thanks for this - looks like it has great potential, but at the moment, you have these errors: Warning: stripos() expects parameter 1 to be string, array given in /site/modules/FieldtypeImageExtra/FieldtypeImageExtra.module on line 229|230|231 which break the image upload due to outputting header content before the image during the ajax upload with PW debug set to true. There are also some layout issues if you disable the orientationField - the Link field only takes up half the page width. I had the same issues as Joss, but switching the field type did the trick!
  18. If anyone is getting this issue with images not properly uploading in PHP5.6, make sure to set: always_populate_raw_post_data to -1 in your php.ini file. The deprecated notice is causing header issues with the ajax uploader. Hope that helps someone else out
  19. That was my doing Martijn - since it's hooking into SaveReady, I thought that "Before" was actually appropriate in this case - it's certainly not renaming after save, otherwise we'd have to save again - right? I certainly don't see any harm in using the true option and I think it should generally be safer for page names and how you are generating them.
  20. Glad it's working, but I would suggest adding the "true" back into the pageName sanitizer. From the docs: "Sanitizes a value for a URL friendly Page name and cleans out leading or trailing dashes, and converts double dashes to single dashes. Use this if you are passing in a headline to convert to a page name (for example)."
  21. Try this: <?php /** * ProcessWire 'Rename Page' module by forum user creativejay * * Checks to see if a page uses the template "blog-post" and has a $p->blog_categories value of "Swatch" then redefines the value of $p->title and $p->name * * * ProcessWire 2.x * Copyright (C) 2014 by Ryan Cramer * Licensed under GNU/GPL v2, see LICENSE.TXT * * http://processwire.com * */ class RenamePage extends WireData implements Module { /** * getModuleInfo is a module required by all modules to tell ProcessWire about them * * @return array * */ public static function getModuleInfo() { return array( // The module's title, typically a little more descriptive than the class name 'title' => 'Rename Page', // version number 'version' => 3, // summary is brief description of what this module is 'summary' => 'Checks to see if a page uses the template blog-post and has a blog_categories value of Swatch then redefines the value of title and name', // Optional URL to more information about the module 'href' => 'https://processwire.com/talk/topic/8863-new-to-hooks-trying-to-wrap-my-head-around-the-syntax/', // singular=true: indicates that only one instance of the module is allowed. // This is usually what you want for modules that attach hooks. 'singular' => true, // autoload=true:indicates the module should be started with ProcessWire. // This is necessary for any modules that attach runtime hooks, otherwise those // hooks won't get attached unless some other code calls the module on it's own. // Note that autoload modules are almost always also 'singular' (seen above). 'autoload' => true, // Optional font-awesome icon name, minus the 'fa-' part 'icon' => 'eraser', ); } public function init() { $this->addHookAfter('Pages::saveReady', $this, 'renameBeforeSave'); } public function renameBeforeSave(HookEvent $event) { $p = $event->arguments[0]; if($p->template->name === "blog_post" && $p->blog_categories == "Swatches"){ $concatenatedName = $p->blog_date; $concatenatedName .= '-' . $p->createdUser; $concatenatedName .= '-' . $p->blog_brand; $concatenatedName .= '-' . $p->blog_name; $concatenatedTitle = $p->blog_brand; $concatenatedTitle .= ' ' . $p->blog_name; $p->title = $concatenatedTitle; $p->name = $sanitizer->pageName($concatenatedName, true); } } }
  22. Yeah, looks like my comment about that crossed with your correction
  23. Very good advice from soma (as always). This is what I usually do: $this->addHookAfter('Pages::saveReady', $this, 'renameBeforeSave'); public function renameBeforeSave(HookEvent $event) { $p = $event->arguments[0]; $p->name = $new_name; $event->return = $p; // maybe this isn't actually needed - haven't tested and can't remember //as soma mentioned - this last line definitely isn't needed! } Of course you'll need to add in your logic to limit by template/category and to build up the new name/title.
  24. Nice idea, but I would personally go for a dedicated table for this. Perhaps you could steal some ideas from teppo's ChangeLog module: http://modules.processwire.com/modules/process-changelog/
  25. In the "Extra Allowed Content" section on the Input tab of your field's settings, add the following: span{!color} That will allow span tags so long as the color style attribute is set. You can get more details here: http://docs.ckeditor.com/#!/guide/dev_allowed_content_rules-section-2 If you want to allow span tags no matter what attributes they have, then use this: span[*]{*}(*)
×
×
  • Create New...