-
Posts
803 -
Joined
-
Last visited
-
Days Won
10
Everything posted by kixe
-
Because it is maybe interesting for others I will answer a question I got in the personal messenger: Does the module have the capability to run from a standard cron job? Yes. The Backup is triggered by the hook function cronBackup() expecting a HookEvent as single argument, which is in fact not needed. If you want to trigger the backup from anywhere, just create a HookEvent object and call the cronBackup() function. Done. $event = new HookEvent; $modules->get('CronjobDatabaseBackup')->cronBackup($event);
-
/** * Send the contents of the given filename via http * * This function utilizes the $content->fileContentTypes to match file extension * to content type headers and force-download state. * * This function throws a WireException if the file can't be sent for some reason. * * @param string $filename Filename to send * @param array $options Options that you may pass in, see $_options in function for details. * @param array $headers Headers that are sent, see $_headers in function for details. * To remove a header completely, make its value NULL and it won't be sent. * @throws WireException * */ function wireSendFile($filename, array $options = array(), array $headers = array()) { $http = new WireHttp(); $http->sendFile($filename, $options, $headers); } Usage $file = $page->filefield->first()->filename(); // or $page->filefield->filename(); depending on your settings wireSendFile($file, array('forceDownload' => true, 'exit' => true)); Example Allow url segments in the template where your button and image exists. $img = $input->urlSegment1? (int) $input->urlSegment1:0; $download = $input->urlSegment2 == 'download'?true:false; $file = $page->filefield->eq($img); if ($download) { wireSendFile($file->filename(), array('forceDownload' => true, 'exit' => true)); } else { echo "<img alt='' src='{$file->url}'/>"; echo "<button><a href='$number/download/'>Download Picture</a></button>"; }
-
$tasks = $pages->find("task_person*=$user->name,parent=/tasks/,include=hidden,sort=-created");
-
$names = "ali,sradesign,nona"; $names = strtr($names, ',','|'); $users = $users->find("name=".$names); @LostKobrakai Always quick
-
Edit: Netcarvers solution is the recommended one. But here an approach from the API side: I think the only way is to use a Textformatter like Markdown or in your case TextformatterNewlineBR. If you want to format your description inside the template use a Textformatter like Markdown or in your case TextformatterNewlineBR. Your description : 'Description with \n Line break' should output: 'Description with <br/> Line break' in your Template: $desc = $page->image->description; $desc = $modules->get('TextformatterNewlineBR')->format($desc); You maybe have to set $page->of(false) before grabbing $desc. Just try out. @netcarver You where quicker and better I didn't know this ...
-
You are lucky your wish comes repeatedly in fulfillment. There are multiple ways for your needs in PW: Fieldtype Repeater Fieldtype RepeaterMatrix (ProField) Fieldtype Table (ProField) Fieldtype PageTable Fieldtype Page + Module AdminPageEditLinks
-
Fieldtype Compatibility Overview doesn't work Fieldtype PageTable inside Repeater or RepeaterMatrix Fieldtype Page + 3d Party module AdminPageEditLinks inside Repeater or RepeaterMatrix works Fieldtype RepeaterMatrix inside RepeaterMatrix Fieldtype Repeater inside Repeater Fieldtype Repeater inside RepeaterMatrix and the other way round Fieldtype Page inside Repeater or RepeaterMatrix Fieldtype PageTable inside Page and the other way round @Martijn (next post) thanks, updated list
-
You can do this from your forum account -> Client Area
- 1 reply
-
- 2
-
Where can I find the translation strings for wiredate
kixe replied to Juergen's topic in API & Templates
/core/WireDateTime.php -
Duplicate content in different sections of the site with different URLs
kixe replied to Pete Jones's topic in API & Templates
Create a new template and a new page which is public accessible. Load your horses in a PageArray and echo your output. To get a specific horse page you can use url segments if ($input->urlSegment1) { $horsename = wire('sanitizer')->pageName($input->urlSegment1); $horse = $pages->get("template=horses,name=$horsename,include=all"); echo $horse->render(); } else { $horses = $pages->find('template=horses,color=black,include=all'); echo "<ul>"; foreach ($horses as $horse) { echo "<li><a href='/public/horses/$horse->name'>$horse->name</li>"; } echo "</ul>"; } Assuming you have an overview site where all horses are listet and depending on your href attributes in the links to specific horses you could use $page->render() too in the 'else' part above. Using render() method you maybe have to disable appended/prepended template files by config.php in the template settings. -
Export/ Import your database and use the same User Authentication Salt from config.php. $config->userAuthSalt = 'xxxxxxxxxxxxxx';
-
setting alternate language names on pages created via the API
kixe replied to Jason Huck's topic in Multi-Language Support
And those ones too: $foo->setLanguageValue($lang,'name', wire('sanitizer')->pageName($value)); $foo->{"name$lang"} = wire('sanitizer')->pageName($value); -
Sometimes I had to reset/ delete parent_id in settings of a PageTable field to force items be placed as children of the page being edited. I did this always by manipulating the database. Other way is to delete the field and create a new one. Both ways are not very comfortable. Is there a better way? Am I missing something? Would be nice to have this option from the field settings.
-
- Fieldtypes
- Admin
-
(and 2 more)
Tagged with:
-
@Filkaboy Which PHP Version do you use? Both Errors you mentioned looking like PHP = 5.3.x Could you make an update of your PHP Version and try again? Thanks.
- 100 replies
-
- template
- autogenerate
-
(and 2 more)
Tagged with:
-
How do I "secure" the source to an iframe to prevent "hotlinking"?
kixe replied to OrganizedFellow's topic in Dev Talk
By default you cannot frame a page running under PW from other domain, because X-Frame-Options is set to SAMEORIGIN In your case you could change the directive to X-Frame-Options ALLOW FROM {uri} Unfortunately this is not supported in all browsers (Chrome?). You have to try out. Maybe best solution is to move to a host which supports PHP and PW of course. -
Follow the slogan "Everything in PW is a page". To stay flexible I would store orders and order items as pages. Use PageFieldEditLinks together with PageFields (ASM Select) to handle/ edit the Page Fields comfortably.
-
Find attached the first Alpha Version of the Module ProcessSetupPageName with Multilanguage Support. I tested it under various circumstances and it is doing fine with one exception: Until now it doesn't work together with 'Page Name Extended' (since PW 3.0.12) which allows UTF8 Page Names. Module requires PHP >= 5.4.x Download from here: EDIT: Removed link, download last version from here: https://github.com/kixe/ProcessSetupPageName/archive/master.zip Would be nice if you could test it and give a feedback to me. Thanks in advance.
- 100 replies
-
- 3
-
- template
- autogenerate
-
(and 2 more)
Tagged with:
-
@Filkaboy Thanks for reporting. I fixed this.
- 100 replies
-
- 1
-
- template
- autogenerate
-
(and 2 more)
Tagged with:
-
Module: AIOM+ (All In One Minify) for CSS, LESS, JS and HTML
kixe replied to David Karich's topic in Modules/Plugins
@szabesz Here you can find a list of the 250+ forks of ProcessWire itself. https://github.com/ryancramerdesign/ProcessWire/network/members -
Module: AIOM+ (All In One Minify) for CSS, LESS, JS and HTML
kixe replied to David Karich's topic in Modules/Plugins
From the PW modules directory you will get always the original version. If the Author like this feature, he has the freedom to include it. I had to make these changes, to get it working properly with my template function library and I want to share this enhancement. Use it if you like it. -
Module: AIOM+ (All In One Minify) for CSS, LESS, JS and HTML
kixe replied to David Karich's topic in Modules/Plugins
I forked the module on github which allows the following paths for example: styles/style.css (relative to template - default) /site/folder/style.css (relative to root - NEW) https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js (absolute path to external source via http request -NEW) https://github.com/kixe/ProcessWire-AIOM-All-In-One-Minify -
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