-
Posts
807 -
Joined
-
Last visited
-
Days Won
10
Everything posted by kixe
-
Module: AIOM+ (All In One Minify) for CSS, LESS, JS and HTML
kixe replied to David Karich's topic in Modules/Plugins
I would like to implement your module in my template engine. Unfortunately it doesn't allow paths outside of the template folder. Would be a big enhancement to accept and find the following. I couldn't get it work. $styles = array(); // relative to the root paths like $styles[] = '/site/modules/whatever/style.css'; $styles[] = '/wire/templates-admin/styles/font-awesome/css/font-awesome.min.css'; // I use this very often // absolute paths $styles[] = 'http://example.org/stylesheet.css'; $urls = AIOM::CSS($styles); $output = "<link rel=\"stylesheet\" href=\"$urls\">\n"; Herewith I put this on the wishlist! Maybe somebody else would like this too The Option 'Allow directory traversal' doesn't really exist. It expects each stylesheet path relative to the templates folder if I understand the following codelines correctly. // ------------------------------------------------------------------------ // Filter Directory Traversal (default: yes) // ------------------------------------------------------------------------ $_path = (self::$directoryTraversal !== true) ? str_ireplace(array('../', './', '%2e%2e%2f', '..%2F'), '', wire('config')->paths->templates.$_file) : wire('config')->paths->templates.$_file; Maybe i missed something and you could help. Anyway a great module you made. Thanks for this. -
Problem retrieving filename from image field in API generated page
kixe replied to bmacnaughton's topic in API & Templates
// should return the full path $image->filename // use $image->basename // debugmode? $config->debug = true; -
I think in your template you can extend the users role on runtime. $user->set('roles',41);
-
How to redirect back to home of current language after login
kixe replied to adrianmak's topic in General Support
This is only true if language of current user (set in backend) is default. // define language var before login take current language of page $language = $user->language // redirect to this language after login $session->redirect($pages->get("template=home")->localUrl($language)); Small hints 1) Read the docs https://processwire.com/api/multi-language-support/multi-language-urls/ 2) use http://example.org/jpn/login instead of http://mydomain.com/jpn/login- 1 reply
-
- 3
-
-
This Module was one of the first modules I have written for PW. By myself I didn't use the module since a long time. Now I integrate Audioplayer normally with html5 audio tag and beautify it using the following 2 Javascript Libraries. http://mediaelementjs.com/ https://github.com/johndyer/mediaelement/ or https://kolber.github.io/audiojs/ But if you like it, I pushed an update (v1.2.0) to github and the modules directory and tested it under 3.0.x without problems. Please read instructions, create a template file like: // template file echo $page->player['code'];
-
I want to have a front-end dashboard for each registered user
kixe replied to adrianmak's topic in General Support
Assuming that each user should have access only to his own account/ content, there is no need to work with UrlSegments since you have access to the $user API. The output of example.org/dashboard/ can be individually to each user. Example: Create a role 'frontenduserrole' without any permission. Create a template dashboard and a file dashboard.php like if ($user->isLoggedin() && $user->hasRole('frontenduserrole')) { echo "Welcome back $user->name"; } else echo "You need to login first."; -
Anyone successfully added CKEditor shortcut keys?
kixe replied to Robin S's topic in General Support
You have to create a plugin, place it in /site/modules/InputfieldCKEditor/plugins/ and enable it in the fieldsettings under Setup > Plugins Take this one as a starting point: Save the following code as /site/modules/InputfieldCKEditor/plugins/keystrokes/plugins.js // Assigne Ctrl+I to "bold" INSTEAD OF 'italic'(default). ( function() { CKEDITOR.plugins.add( 'keystrokes', { init: function( editor ) { editor.setKeystroke( CKEDITOR.CTRL + 73 , 'bold' ); } }); } )(); -
With Standard Processwire Installation you have the option to configure SetupPageName (childNameFormat) under Tab Family in the Parent Template, which allows you to derive (auto assign) the name from title. Until now this is not possible with id. But you could use the following module which extends the SetupPageName function exactly for your needs. http://modules.processwire.com/modules/process-setup-page-name/ Unfortunately this module doesn't work properly in multilanguage surrounding. If you want to use the Field in multiple pages it might by better to use a Page field instead of PageTable. If you define Parent and Template in the field settings you can add a new Page from the field too. Pages in PageTable Field must be created/ deleted from Field.
-
How to set same title to every language/page
kixe replied to steveooo's topic in Multi-Language Support
I cannot test it but in module scope you maybe cannot use the $languages api. Try with wire('languages'). Do you have debug mode on? Try this one protected function syncLangProperty(Page $page, $property) { $languages = $this->wire('languages'); if ($this->wire('modules')->isInstalled('LanguageSupport') && !empty($page->getLanguageValue($languages->getDefault(), $property))) { $defaultValue = $page->getLanguageValue($languages->getDefault(),$property); foreach ($languages as $language) { $page->of(false); $page->setLanguageValue($language, $property, $defaultValue); $page->save($property); } } return $page; } -
How to set same title to every language/page
kixe replied to steveooo's topic in Multi-Language Support
$globalTitle = 'Test'; foreach ($languages as $language) { $page->of(false); $page->setLanguageValue($language, 'title', $globalTitle); $page->save('title'); } -
Correct Syntax for Fieldtype Select Options $optionsfield // return id (string) $optionsfield->id; // return id (int) $optionsfield->title; // return string USE THIS or $optionsfield->value; // return empty string or value (if your option settings like '1=value|title') // dot syntax in selector string $pages->find('optionsfield.id=2'); Docs: https://processwire....tions-on-a-page or https://processwire....d-on-selections @BitPoet $page->manufacturer return id as a string, NOT the title!
-
Your approach will not work. If you want to go on with repeaters you have to use nested repeaters. Other options: Page/ PageTabel Field or ProFields Matrix. More Information about nested repeaters and ProFields Matrix here: https://processwire.com/blog/posts/more-repeaters-repeater-matrix-and-new-field-rendering/ I would do this job with a simple Page or PageTable Field Create some fields (currency, period, percent) Create a template 'rate' and assign the fields above Create some pages (rates) with template 'rate' USD 12m 5% USD 6m 5% EUR 6m 6% Create a Page Field 'rates' and use template 'rate' for selectable pages Assign this Page Field to the 'loan' template.
-
@Juergen, obviously I missed your post half a year New Edition But finally I found it and redesigned the template file I provided in post 88 of another thread It is working now properly according to the google guidelines. It comes with 301 redirect to the path version that lacks the language segment which works in PW 3.0 up but not in 2.7. In this case you need to uncomment the code line which forces the redirect. Template detects if the translation is checked 'active'. Furthermore you can easily adjust selectors for the page array where the pathes are taken from. Feel free to try and use it. multilang-sitemap-xml.php.zip
-
It works using wireSendFile(). New template: <?php /** * using this template allows you to use template cache * */ $file = $page->pdf->filename; $disposition = 'inline'; // change to 'attachment' to provide download $headers = array( "content-length" => filesize($file), "content-disposition" => 'inline; filename="'.basename($file).'"' ); wireSendFile($file, array('forceDownload' => false), $headers); Define any headers to set new or overwrite default. "Force download 'must be set to false to avoid that 'Content-Disposition' is overwritten due to file extension. But I am not sure if this uses the cache. Maybe its useless anyway it takes the same time to render.
-
@LostKobrakai Thanks, I know this. But this is only the Content-Type header. I want to change some others too! As a minimum: Content-Disposition and Content-Length.
-
Hi there, I am using the following template file to provide a pdf download, of a pdf stored in a file-field. <?php $file = $page->pdf->filename; header('Content-Type: application/pdf'); header('Content-Disposition: attachment; filename="'.basename($file).'"'); header('Content-Length: ' . filesize($file)); readfile($file); If template caching is disabled, everything working as expected and the following header is sent HTTP/1.1 200 OK Date: Fri, 26 Feb 2016 13:03:27 GMT Server: Apache X-Frame-Options: SAMEORIGIN Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Content-Disposition: attachment; filename="anyfile.pdf" Content-Length: 909233 X-XSS-Protection: 1; mode=block Keep-Alive: timeout=2, max=1000 Connection: Keep-Alive Content-Type: application/pdf Using Template cache the header is overwritten by HTTP/1.1 200 OK Date: Fri, 26 Feb 2016 13:06:11 GMT Server: Apache X-Frame-Options: SAMEORIGIN Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache X-XSS-Protection: 1; mode=block Vary: Accept-Encoding Content-Encoding: gzip Keep-Alive: timeout=2, max=1000 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: text/html; charset=utf-8 Any ideas to prevent this?
-
How to hook into "view" links on tree and page edit
kixe replied to steveooo's topic in Module/Plugin Development
A module is needed doing this. How to build a module: http://wiki.processwire.com/index.php/Module_Creation Get informed about hooks here: https://processwire.com/api/hooks/ This one should do the job <?php /** * ProcessWire Module Modify View Url * * @version 100 * @copyright 2016 Christoph Thelen * @author kixe (Christoph Thelen note@qualyweb.com) * */ class ProcessModifyViewUrl extends Process implements Module, ConfigurableModule { static public function getModuleInfo() { return array( 'title' => 'Modify View Url', 'summary' => 'Provide alternative url for the action button \'view\' and the view tab under /page/edit/', 'author' => 'kixe', 'version' => 100, 'singular' => true, 'autoload' => true, 'icon' => 'mail-forward' ); } static public function getDefaultConfig() { return array( 'url' => 'http://example.org' ); } public function __construct() { foreach(self::getDefaultConfig() as $key => $value) { $this->$key = $value; } } public function init() { $this->addHookBefore('ProcessPageEdit::buildFormView', function($event) { $event->arguments(0, $this->url); }); $this->addHookAfter('ProcessPageListActions::getActions', function($event) { $actions = $event->return; $actions['view'] = array( 'cn' => $actions['view']['cn'], 'name' => $actions['view']['name'], 'url' => $this->url ); $event->return = $actions; }); } public function getModuleConfigInputfields(array $data) { $inputfields = new InputfieldWrapper(); $defaults = self::getDefaultConfig(); $data = array_merge($defaults, $data); $f = wire('modules')->get("InputfieldText"); $f->attr('name+id', 'url'); $f->label = __("Alternative Url"); $f->value = $data['url']; $inputfields->add($f); return $inputfields; } } -
I think yes, some usage examples: //validate user $session->isValidSession($userID) //get the IP address of the current user $session->getIP() // login a user $session->login($name, $pass) // login a user without requiring a password $session->forceLogin($user) // return true or false whether the user authenticated with the supplied password $session->authenticate(User $user, $pass) // logout the current user, and clear all session variables $session->logout() // redirect this session to another URL $session->redirect($url) // get the session history (if enabled) $session->getHistory() Further informations: https://processwire.com/apigen/class-Session.html http://cheatsheet.processwire.com/ http://processwire.com/api/variables/session/
-
If 'View/ Edit links on selected pages' is enabled this option should be hidden in case user has no edit permission for the selected page. Now an ugly error message is shown in the modal. Would be nice to not provide the link in this case. Apart from this module is working properly under 3.0.8. Thumbs up and many thanks for the last fixes.
-
I am working on 2 Sites going only within the next month. Another big one going online maybe in June. A private site is already online. Until now everything is working quite stable. Look forward, not backwards.
-
Same like BitPoet. Used it nearly ten years ago. It is very limited compared to PHP. Most of the hosters are providing comfortable and cheap PHP and MYSQL Environments. No need to use SSI.
-
11 month old this topic but I run in same problems described in post #5 (PW 3.0.8) After digging a while I found out that Javascript puts WireTabs outside the form whereas normally (for example in ProcessPageEdit) the WireTabs are inside the form. You need to adapt the css for the form in this case like: #content .container > form { /*instead of: top: -2px;*/ top: 0; } #content { /*instead of: padding-top: 1px;*/ padding-top: 0; } This solution works for me.
-
Many Thanks. This will be a first choice development tool.
-
Thanks for the quick answer. I am pretty sure your module works proper in 2.7. I am involved in 2 projects both based on 3.0 probably going online in summer. I updated already most of my stuff for 3.0. Ryan is working very very quick and I am pretty sure we will have a stable Version of 3.0 very soon.
-
Hi kongondo, I tried out your huge module and I think would like it, but it doesn't work properly (using PW 3.0.7). I will give you a small bug list. clicking on Posts results in Error: Call to a member function count() on null (line 1355 of .../site/modules/ProcessBlog/ProcessBlog.module. Problem: field blog_files isn't assigned to the blog-post template by default which is the reason for the error above. After removing line 1355 the modal for posts doesn't appear after clicking, linked page opened instead The dropdown function of the tabs in Admin are disabled if blog tab is active cannot open Settings -> Settings -> Edit cannot open Tags -> New -> Tags Add cannot open Categories -> New Categories -> Add cannot open Posts -> Quick Post -> Add cannot open Edit Posts -> Actions Dead link (404) in Module description on processwire.com http://kongondo.com/tutorials/specific-features/creating-a-blog-in-processwire/ (just realized in the topic of this thread a temporarily link to the tutorial) A personal wish: Dashboard -> Archives -> month clickable with link to a list of selected items