Jump to content

kixe

Members
  • Posts

    803
  • Joined

  • Last visited

  • Days Won

    10

Everything posted by kixe

  1. 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);
  2. /** * 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>"; }
  3. $tasks = $pages->find("task_person*=$user->name,parent=/tasks/,include=hidden,sort=-created");
  4. $names = "ali,sradesign,nona"; $names = strtr($names, ',','|'); $users = $users->find("name=".$names); @LostKobrakai Always quick
  5. 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 ...
  6. 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
  7. 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
  8. You can do this from your forum account -> Client Area
  9. 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.
  10. Export/ Import your database and use the same User Authentication Salt from config.php. $config->userAuthSalt = 'xxxxxxxxxxxxxx';
  11. And those ones too: $foo->setLanguageValue($lang,'name', wire('sanitizer')->pageName($value)); $foo->{"name$lang"} = wire('sanitizer')->pageName($value);
  12. 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.
  13. @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.
  14. 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.
  15. 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.
  16. 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.
  17. @Filkaboy Thanks for reporting. I fixed this.
  18. @szabesz Here you can find a list of the 250+ forks of ProcessWire itself. https://github.com/ryancramerdesign/ProcessWire/network/members
  19. 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.
  20. 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
  21. 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.
  22. // should return the full path $image->filename // use $image->basename // debugmode? $config->debug = true;
  23. I think in your template you can extend the users role on runtime. $user->set('roles',41);
  24. 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
×
×
  • Create New...