-
Posts
6,798 -
Joined
-
Last visited
-
Days Won
158
Everything posted by Soma
-
Added several new actions. Added shortcuts to admin main pages. The most fun is to open a autcomplete search to find and edit templates or fields. Now you can wherever you are press "ctrl+shift+t" or "ctrl+shift+f" and get something like this: Once open you can type and select, hit enter and directly go to edit screen. Enter a char and hit backspace to show all. Have fun.
-
Thanks Marty, just commited an update that should fix it for FF.
-
Just made an update to be even more great!
-
Your welcome. Thanks. Little update after playing around a little. changed to use save hot key for all edit screens to save not only page. added "Add new" hot key support for Template, Fields, Users, anything that has a "Add new" button. Have fun.
-
ProcessWire2.+ Admin Hot Keys 0.0.7 This modules adds hot keys functionality to PW backend. The keys can be configured in the module settings in the admin. I created a repo here for download and if anyone interested in picking it up. https://github.com/s...ic/AdminHotKeys Currently it supports Save : ctrl+s Add New : ctrl+n View Page : ctrl+v Open Pages search : alt+q (search field can be configured) Open Templates search : ctrl+shift+t Open Fields search : ctrl+shift+f Goto Pages : ctrl+shift+p Goto Setup : ctrl+shift+s Goto Modules : ctrl+shift+m Goto Access : ctrl+shift+a Note: If you're inside a text input it will ignore the hot keys, as to avoid problems with already defined key. Tip: If you open up templates or fields autocomplete search `ctrl+shift+f|t` press `shift+tab` to focus on the link in the label previous to the search input box. Now hit enter to get right to the template or field screen. (If using FF make sure to enable tab focus for all elements in MacOSX: http://support.mozil...enus or buttons)
- 48 replies
-
- 14
-
I just started and created a simple module to add hot keys, currently only starting with Page Save. https://github.com/somatonic/AdminHotKeys
-
Does it work for you in Safari here: http://html5demos.com/file-api? Safari doesn't support file upload API PW is using, thus the drag upload message isn't showing, it will fall back to traditional method.
-
I would question the need for a CMS to do this. This either can better and should be done using some setup server side or locally using grunt.js or similar there's many great resources. Edit: Not excluding that there could be a simple module helping setting it up. Not sure if that would make sense though.
-
Cutting long content into URL segments with HTML tag
Soma replied to nikola's topic in General Support
There's no HTML for page break, but css has (for printing context) http://www.w3schools.com/cssref/pr_print_pageba.asp -
Yes Pete , that's exactly what I did on one site. But I try to avoid this setup.
-
ProcessWire has the functionality to add scripts and css using $config var. $config->scripts->add(pathto.js) $config->styles->append(pathto.css); Then the output <?php foreach($config->styles->unique() as $file) echo "\n <link type='text/css' href='$file' rel='stylesheet' />"; ?> <?php foreach($config->scripts->unique() as $file) echo "\n <script type='text/javascript' src='$file'></script>"; ?> This way a module could also add script using this. But there's no front-end module that does use it. It's up to the site builder.
-
Cutting long content into URL segments with HTML tag
Soma replied to nikola's topic in General Support
I still trying to understand why you need to... Also using repeaters will simplify alot, even you could maybe make it up . Seeing you can't put the script up or don't even try to, I don't think it's a good idea to take an advanced script you don't understand, and it can get complicated... Well I don't want to be mean, something like this should help: $bodyArray = preg_split("/(<h4>.+?<\/h4>)/", $page->body, 0, PREG_SPLIT_DELIM_CAPTURE); // get urlsegment pageNum, pageNum's needs to be turned on on template setting // returns 1 by default even if no urls segments set. $pnr = $input->pageNum; if($pnr == 1) { echo $bodyArray[$pnr-1]; } else { $pnrText = ($pnr-1)*2; $pnrSep = $pnrText - 1; echo $bodyArray[$pnrSep] . $bodyArray[$pnrText]; } // add link list to all text pages splited $count = (count($bodyArray)-1) / 2 + 1; for($i = 1; $i <= $count; $i++) { if($i == 1) { $title = "<h4>First Page</h4>"; } else { $title = $bodyArray[($i-1)*2-1]; } $class = ''; if($i == $pnr) $class = " class='active'"; echo "<a$class href='./page{$i}'>{$title}</a>"; } EDIT: Optimized code a little as the count wasn't right. -
Cutting long content into URL segments with HTML tag
Soma replied to nikola's topic in General Support
If you really really want to do it like this I would consider using repeaters here. It will simplify a lot. Also I don't know if that url segment you're talking about is the best option. I sense it would make more sense form a SEO point to consider something like URL: / articles/lorem-ipsum/2 or URL: /articles/lorem-ipsum/page2 From there, using repeaters would be easy thing to mapp the nth repeater to the 1st urlsegment. If really wanting to use 1 text field with h4 as the separator I would try doing it client side with jquery. Not that it's not possible with php, just think it could make sense to not generate additional url indexes. Though from a marketing standpoint those will love it as it generated more page impressions. -
wire("config")->urls->admin in autoload module init() not available?
Soma replied to Soma's topic in General Support
If it's not of an issue to have it set in the init. Just thought I'd ask here since I assumed it should be available and couldn't see why it shouldn't. Thanks Ryan! -
wire("config")->urls->admin in autoload module init() not available?
Soma replied to Soma's topic in General Support
Thanks Ryan for the explanation. I have to use init() as to change the $_GET("it") before page load. I have used $this->pages->get(2)->url to get the admin url (which may have changed). -
There's no field access yet, but I've heard rumors that it will come sooner or later. However you can create a simple module that does hide/show fields on a condition, whether a custom permission, role or user. Following is a simple autoload module that hooks the Inputfields and returns empty string, if condition aren't met. Actually very straight forward and powerful. There could be added some module configuration, to simply add fields via a textfield you want to hide for other users. Possibilities are endless. Save the code as FieldHelper.module and put it in /site/modules/ Configure it to your needs and install it. <?php class FieldHelper 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( 'title' => 'FieldHelper', 'version' => 100, 'summary' => 'Hide fields depending on permission, role, or user.', 'singular' => true, 'autoload' => true ); } public function init() { // add after-hook to the inputfield render method $this->addHookAfter("Inputfield::render", $this, "renderField"); } /** * Hide fields depending on permission or possibly role, user * */ public function renderField(HookEvent $event) { // get the current field $field = $event->object; // example 1permission if($field->name == "pre_content") { if(!$this->user->hasPermission("admin-fields")){ $event->return = ''; } } // example 2 role if($field->name == "after_content") { if(!$this->user->hasRole('superuser')){ $event->return = ''; } } // example 3 user if($field->name == "page_scripts") { if(!$this->user->name('admin')){ $event->return = ''; } } } } I created a gist for this example here: https://gist.github.com/3122191
-
should be ... $video->template->set('filename', 'teaser.php'); ... $template->setFilename() is protected.
-
Ok, I have implemented a language domains option you can now enable in the module settings. I did some testing on my local install and so far everything works as it should. I just commited the update and it's ready to use. urlSegments , pager, page links in language text fields still work and I didn't notice any problems. However it's not sure any other side-effects pop up I may missed, apart from the ones already there. From readme: This module now supports language domains. So you can have each language mapped to its own domain. To make this work you need to have the different domains point to the default domain and PW install. Then enable this option in the module settings and enter your domains in the textarea, each domain on its own line. The format is [domain:langcode] i.e.: domain.com:en domain.de:de domain.fr:fr You could also use subdomains: en.domain.com:en de.domain.com:de fr.domain.com:fr Result: Now you can access the different languages simply through the different domains. For example the "/about/" page would be available like this: domain.com/about/ domain.de/ueber/ domain.fr/au-sujet-de/
-
PW has also such a module that does what you're saying. http://processwire.c...ink-abstractor/ it's listed here http://processwire.com/download/modules/
-
The simplest way is to have the domain.com point to domain.de. Done. Now it depends on how you create the language switch. Just adding the domain in front of the url would be enough. But you will end up having domain.de/de/.. and domain.com/en/... The module has an option to hide default language folder, so /de/ will not show. But for alternative languages there currently no way, without adding anther option to hide them all. Let me know if that would for out for you, and I'll try to implement it.
-
Testing for the first element in a wirearray
Soma replied to thetuningspoon's topic in General Support
I think in this case correct would be == not === but both will work. There's some coverage of it here http://www.php.net/manual/en/language.oop5.object-comparison.php There seem to be a case when testing with "==" when "===" should be used to indentify objects can result in a overhead that could be avoided. Not sure what really is the better option id==id or object===object. Maybe someone else can tell better. -
Testing for the first element in a wirearray
Soma replied to thetuningspoon's topic in General Support
Thanks arjen for posting this. Well it has nothing really to do with the while loop it's just another variant. It can be done with a foreach or for loop $newsItemList = $page->children; $cnt = 0; foreach($newsItemList as $news) { $cnt++; if ($cnt == 1) { // do stuff } else { // do stuff } } -
Hi and welcome. Thanks for the report. I'm sure Ryan will soon comment, as I think he's the one really knowing what's going on.
-
Testing for the first element in a wirearray
Soma replied to thetuningspoon's topic in General Support
Always forget about it but thought I'd mention it. You can also use if( $newsChildPage->id == $newsChildrenArray->first()->id ) { ... which is even better and should be faster although not sure how much really.