-
Posts
11,097 -
Joined
-
Last visited
-
Days Won
365
Everything posted by adrian
-
It's mentioned here: http://processwire.com/api/include/ although I think also somewhere else that I can't find right now.
-
Hi @onionradish and welcome to the forums. You need to make use of wire('page') etc when using inside a function.
-
Hey teppo, Minor, but fatal, bug for you. If you have Template checked under Visibility Settings and there are some entries in the log that refer to a template which has since been deleted from the system, you get a: Fatal error: Call to a member function get() on a non-object in /site/modules/ProcessChangelog/ProcessChangelog.module on line 765 Obviously just need a check to make sure that the template still exists. Thanks!
-
Obviously a much better approach from Soma! so I definitely don't deserve a "Solved" on this one Of course my original code snippet didn't exclude other fields, but I was thinking something along the lines of checking the name of the field before proceeding - just didn't get that far when posting in a rush yesterday
-
Extending module, problem with config
adrian replied to MadeMyDay's topic in Module/Plugin Development
@MadeMyDay - I love what I think you are doing with this module - I was having an idea just like this the other day - can't wait to see what you come up with -
EDIT: Ignore this idea completely - soma's solution hooking into InputfieldButton::render is obviously a much better idea I don't have time right now to put a working solution together, but you'll want to hook into InputfieldPageTable::render and do an $event->replace = true and then scan the content and strip out the add new button. You could do that with a regex, eg: function strip_selected_tags_by_id_or_class($array_of_id_or_class, $text) { $name = implode('|', $array_of_id_or_class); $regex = '#<(\w+)\s[^>]*(class|id)\s*=\s*[\'"](' . $name . ')[\'"][^>]*>.*</\\1>#isU'; return(preg_replace($regex, '', $text)); } or perhaps more efficiently with domdocument's removeChild() - eg: http://stackoverflow.com/questions/12903483/remove-a-domnode-with-a-certain-class-in-php Something like this: <?php class RemoveAddButton extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Conditionally Remove Page Table Add Button', 'version' => 1, 'singular' => true, 'autoload' => true ); } public function init() { $this->addHookAfter('InputfieldPageTable::render', $this, 'removeButton'); } public function removeButton(HookEvent $event) { $event->replace = true; if(count(array)==0){ $event->return = regex or removechild here to remove button from original $event->return; } } Hope that gets you going. Otherwise, I'll put something working together for you tomorrow.
-
Remember though that srcset is not available that widely available just yet: http://caniuse.com/#search=srcset So that link I sent you to mentions the picturefill polyfill that you'll need to get going with it now: http://scottjehl.github.io/picturefill/#getting-started
-
This is not really PW related. Some googling should get you going. https://developers.google.com/maps/tutorials/customizing/custom-markers
-
Not specifically about retina images, but rather responsive images in general and the polyfill for the new standard: http://css-tricks.com/video-screencasts/133-figuring-responsive-images/ Includes mention of providing a specific 2x version of images.
-
Here is a configurable version. Choose the desired parent page from the module settings: https://gist.github.com/adrianbj/437e3945e9d774f5a67e
-
I think you added the solution to the wrong post By the way, I updated my post to make it a complete working module for you! Of course this module could be extended to make the parent page selectable via the module's config settings.
-
Use this simple module. Just replace the xxxx with the ID of the root page you want to start from. EDIT: ignore this version and use the configurable one posted on gist: https://gist.github.com/adrianbj/437e3945e9d774f5a67e class ChangeImageSelectParent extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Change Image Select Parent', 'version' => 1, 'singular' => true, 'autoload' => true ); } public function init() { $this->addHookAfter('ProcessPageEditImageSelect::execute', $this, 'changeParent'); } public function changeParent(HookEvent $event) { $event->replace = true; $event->return = str_replace("rootPageID: 0", "rootPageID: xxxx", $event->return); } }
-
The multiple row line height is new in a fairly recent PW dev version.
-
There are lots of PHP libraries for creating PDFs dynamically. mPDF seems pretty popular these days: http://www.mpdf1.com/mpdf/ Also check out this guide for using it with PW: https://processwire.com/talk/topic/7025-how-to-create-pdfs-with-pw-and-mpdf/
-
Show unpublished page to logged out users
adrian replied to Torsten Baldes's topic in General Support
I haven't used it, but there is also this module that might suit your needs: http://modules.processwire.com/modules/process-page-draft/ -
Repeater, pages selector and "connected data"
adrian replied to moonwhaler's topic in General Support
I agree that the PageTable field is not perfect in this sense, but there is a way around this: Set up the Automatic Page Name Format option for the PageTable field and then go to the title field and adjust the settings in context of the template being used for the PageTable field content and uncheck required and set it to hidden. So it's still there, but at least it's not in the user's way. This way the page can be published without the title field. Hope that helps a bit. -
@blad - what version of PW are you running? Looks like there was a bug in 2.4: https://processwire.com/talk/topic/7315-change-loop-order-without-reordering-items/?p=70460 And scroll down from there for teppo's response: https://processwire.com/talk/topic/7315-change-loop-order-without-reordering-items/?p=70467 Hope that helps and you don't get that error in the dev version of PW. If you do, then maybe submit an Issue on Github and reference that thread and this one.
-
What about this one: https://processwire.com/talk/topic/6003-conflict-bw-parent-of-selectable-pages-and-custom-selector/?p=58695 Seems like it matches your scenario of having a custom selector. To quote arjen: "I think you have to "unselect" the Parent of selectable page(s)."
-
Then it sounds like you are running an old config.php file - a version of PW from before that setting was added. You can grab a new version and take a look through to see if there are any other new settings you are missing. I don't recommend replacing it with a new version - you're better off just adding the new settings to make sure you don't break any of your database settings, userAuthSalt etc.
-
Back at my desk again, and thinking through this properly - I think the better option is actually: $np->images->add($p->images->last()->filename); You either need the full URL or the full disk path. I think that is where you were having trouble. In my first example, it wasn't working without the 'http://'.$config->httpHost part, but using "->filename" works great and is cleaner!
-
Should be right at the very end: $config->httpHosts
-
In a rush so not the cleanest code, but this seems to work for me - is this what you are looking for? $p = $pages->get(xxxx); //id of page to copy $np = new Page(); $np->of(false); $np->parent = $pages->get(1); //set parent to homepage $np->template = "basic-page"; $np->title = 'test new page'; $np->save(); $np->images->add('http://'.$config->httpHost.$p->images->last()->url); $np->save();
-
But if you want to add Bootstrap to an existing PW install, you really only need to grab the bootstrap files - put the css and js files in appropriate locations and then modify your template files to use the div structure and css classes that bootstrap requires to work it's layout. Shouldn't be too difficult at all if you are html/css savvy.
- 3 replies
-
- 2
-
-
- PROCESSWIREBOOTSTRAP3
- module
-
(and 2 more)
Tagged with:
-
I think the PageTable field from a recent dev version is likely a good option, but another alternative is: https://processwire.com/talk/topic/6102-batch-child-editor/ In the modules config settings you may want to disable overwrite mode (and maybe even Add mode). See the screenshot under 3. Edit mode - it allows for easy adding, sorting, and editing of titles, along with modal editing of pages, kinda like PageTable, but unlike with PageTable, pages that are added manually as children will also be available for editing via this interface.
-
I appreciate blad's investigations into the issue and PM'ing @Vizz to alert her of the problem. We should all be informed (and help to inform others) about the potential issues with the systems we use, or maybe considering to use at some point. I just felt that the tone of the conversation had started to cross the line from being helpful, towards the bashing of WP. I know I have been guilty of criticizing certain aspects of all of the big three CMS's in my discussions with clients. I just think those thoughts should be kept out of this forum. I think in reality it's a shame this thread exists in the first place - it's not really appropriate for this forum, but maybe I am over-reacting - from my experience here I don't think anyone here would really start a flame war about any other system - these forums just don't have that vibe
- 22 replies
-
- 3
-
-
- web design
- web development
-
(and 1 more)
Tagged with: