Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/26/2016 in all areas

  1. From a noob on the outside looking in, I feel a need to state the obvious. I have been spending a fair amount of my time lately installing and working with a few of the 'popular' CMS offerings. I haven't honestly decided what product I'm going to go with yet. For the type of sites I hope to be doing, PW might be overkill. But that's off topic here. Just speaking from my own observations so far.... The Processwire forums and community easily outshines the others ... overwhelmingly. I am not going to name names and I'm just guessing that the accompanying argument from the competition would be something like 'Well , there's only so many hours in a day, and we're a small group of developers with other jobs, family , etc , so whatever time we can spare, we put it into development , patching, etc.'. And that argument is a completely valid one. The point is though, that it appears a number of people involved with PW, with I'm sure the same obligations, ARE taking the time to make the community here what it is - very knowledgeable , very friendly and VERY valuable to those who otherwise might be Googling for hours on end looking for a solution, and we all know how much fun that can be. Well maybe not all of us, but I know I have been there on more than one occasion because the so called documentation was outdated, couldn't find an answer in the 'forum' and I wasn't in the mood to walk through the code with XDebug that day. Anyway, I have rambled enough. Thanks again to ALL. You ALL have a GREAT community here.
    11 points
  2. To complete Adrians answer, the ProcessForgotPassword.module tries to determine the 'from' Email address in 3 steps (fallback) from the Modules settings, like Adrian described from config.php $config->adminEmail = info@example.org; construction of an Email address based on $config->httpHost like: $from = 'processwire@' . $config->httpHost; This happend in your example.
    5 points
  3. I've just found this: https://www.sendinblue.com/mailchimp/ (comparison). The website and administration are available in several languages (like for MailerLite).
    4 points
  4. Building menus for any usage has been discussed a lot over the years. Here's one post: https://processwire.com/talk/topic/2787-custom-menu-not-related-to-page-tree/#entry27275 In the end, i have found that having a branch on the page tree for the menu is the most flexible and easiest to: - code custom navs from (mega menus, boostrap etc) - publish/unpublish menu items - use permissions for menu items (e.g. show some menu items to logged in users) - insert stuff like forms, videos etc into a menu and it works very well with MSN (markup simple navigation) because it allows you to set the parent...
    4 points
  5. There is a setting for the Forgot Password module that lets you set the from email address.
    3 points
  6. How about that? $pages->get($mySettingsPageId)->body;
    2 points
  7. I wrote to them (even though I knew it would make no difference) in order to note that for my use-case [send very few emails per month] the new price model was completely inappropriate; I used about 2% of the potential emails I had to pay for per month; 98% of my fee being effectively unused. The next month wash and repeat. I went from being a fan to a lost (low spend) client. VERY happy with http://postmarkapp.com/.
    2 points
  8. Also look into the template switch based on your subdomain by Raymond.
    2 points
  9. Why don't you try it and see what happens
    2 points
  10. Absolutely right - a typo on my part, which I have corrected above. Christophe is right about the < error, too - I've put that right, also. I think the main point of my example is that you can 'mix' PHP and HTML on the page, and it doesn't have to be 'all' PHP. Essentially, the PHP interpretor looks for anything after a <?php (or a <?= which is a shorthand for <?php echo) and will keep trying to process it until it reaches a ?>. Then it hands over to Apache or NGINX, to serve the result to the browser. (Vastly simplified.) That's where the error Christophe found comes from - because I had missed the closing ?> the PHP interpreter was still trying to make sense of the HTML (</ul>) following what should have been my closing ?>, had I not missed it. So we can use <?php foreach($page->team as $member): ?> then do all sorts of things including other bits of PHP, before <?php endforeach; ?> tells PHP that it has reached the end of the loop. If there are 6 team members, PHP will go through the code between those tags once for each (foreach, geddit?) team member. Perhaps it helps to thing of two 'different' ways of using PHP (bear with me, I'm grossly generalising). One is the 'programming' way, where everything or nearly everything on the page is pure PHP code. (Many of the files in PW's core, for example.) The other is 'PHP as a template language' where most of the page is HTML and a little bit of PHP adds functionality, like the big example above.
    2 points
  11. Basicly you have one folder for templates by default. This is configured to be in "site root" + templates/ You are able to overrule this setting from the site/config.php as follow $config->urls->templates = $config->urls->site . 'mytemplates/'; $config->paths->templates = $config->paths->site . 'mytemplates/'; A trick i use a lot when developing in a live site is to duplicate the template folder and rename the copy to templates-dev. Then make sure i have an other domain (or subdomain) pointing to the hosting, for example dev.domain.ext and for the live site on www.domain.ext With the following code i can access the development templates while normal visitors keep getting the default templates. /** * Development: Alias for template-dev access * */ if($_SERVER['HTTP_HOST'] == 'dev.domain.ext') { $config->urls->templates = $config->urls->site . 'templates-dev/'; $config->paths->templates = $config->paths->site . 'templates-dev/'; $config->debug = true; } You can make up all kind of 'rules' to go by when overruling the templates folder with php from the config.php file. For example serving the same site with different layout and code for mobile on m.domain.ext /** * Mobile: Alias for template-mobile access * */ if($_SERVER['HTTP_HOST'] == 'm.domain.ext') { $config->urls->templates = $config->urls->site . 'templates-mobile/'; $config->paths->templates = $config->paths->site . 'templates-mobile/'; }
    2 points
  12. Today I want to share a little module that adds 2 additional save buttons with redirect and 1 unpublish button to the page edit. 2 additional save buttons: My intention was that it would be nice if someone saves an article in the backend and will be redirected after saving directly to the frontend page of the article. This module adds 1additional save button at the bottom next to the default save button and 1 at the top. So you can choose if you want to save the article with the default save button or you will save it with the custom save button and you will get redirected to the frontend article. 1 unpublish button: The idea behind this was that I want to disable the setting tab for non superuser. The problem was if I hide it, then non superusers are no longer able to unpublish an article. Therefore this module adds an additional unpublish button at the bottom - the user clicks it and the page will be saved with status unpublished. All pages under the admin section will not be affected of this module. Module is multilingual, so you can set the button texts in all languages. Top view page status published: Bottom view page status published: Bottom view page status unpublished: Here is the code: <?php /** * Adding 2 additional save buttons with redirect to frontend and 1 unpublish button for page edit form. * * ProcessWire 2.x * Copyright (C) 2010 by Ryan Cramer * Licensed under GNU/GPL v2, see LICENSE.TXT * * http://www.processwire.com * http://www.ryancramer.com * */ class CustomPageSaveAndUnpublish 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' => 'Custom page save and unpublish module', 'version' => 1, 'summary' => 'Example for adding 2 additional save buttons with redirect and 1 unpublish button to page edit', 'href' => 'http://www.processwire.com', 'singular' => true, 'autoload' => true ); } /** * Initialize the module * * ProcessWire calls this when the module is loaded. For 'autoload' modules, this will be called * when ProcessWire's API is ready. As a result, this is a good place to attach hooks. * */ public function init() { $this->addHookAfter("ProcessPageEdit::buildForm", $this, "addSaveButton"); $this->addHookAfter("ProcessPageEdit::buildForm", $this, "addUnpublishButton"); // tell processwire that this is a page save if ($this->input->post->submit_save_minor) { $this->input->post->submit_save = 1; // attach hook on page save $this->addHookAfter("Pages::saved", $this, "hookPageSave"); } if ($this->input->post->submit_unpublish) { $this->input->post->submit_save = 1; // attach hook on page save $this->addHookAfter("Pages::saveReady", $this, "hookPageSaveReadyUnpublish"); } } public function hookPageSave($event) { //function to redirect to the frontend after save $page = $event->arguments("page"); if ($this->input->post->submit_save_minor) { // this will get saved after this saveReady hook so no need to save here $pageid = $page->id; $goto = wire("pages")->get("id=$pageid")->url; //get url of frontend article wire("session")->redirect($goto); } } public function hookPageSaveReadyUnpublish($event) { //function to change the status to unpublished $page = $event->arguments("page"); $status = $page->status; $unpublishmessage = __("Status of the page is set to unpublished"); if ($this->input->post->submit_unpublish) { if ($status == 1) { $page->status = "2049"; $this->message($unpublishmessage); } } } public function addSaveButton($event) { //function to add the 2 additional save button with redirect at the top and at the bottom $page = $event->object->getPage(); $status = $page->status; if (($page->rootParent->id != "2") AND ($status == 1)) { //dont show on all pages which are under the admin section and which are not published $form = $event->return; $buttontext = __("Save and go to page"); // new submit button $f = $f2 = $this->modules->InputfieldSubmit; $f->attr("name", "submit_save_minor"); $f->attr("value", $buttontext); $f2->attr("name", "submit_save_minor"); $f2->attr("value", $buttontext); $f2->class .= ' ui-priority-secondary head_button_clone'; // add submit button after the regular save button only if page is published $form->insertAfter($f, $form->get("submit_save")); $form->insertAfter($f2, $form->get("submit_save")); } } public function addUnpublishButton($event) { //function to add the unpublish button at the bottom if page has status published $page = $event->object->getPage(); if ($page->rootParent->id != 2) { //dont show on all pages which are under the admin and dont show the button under the delete tab $form = $event->return; $unpublishbuttontext = __("Unpublish"); // new submit button $f = $this->modules->InputfieldSubmit; $f->attr("name", "submit_unpublish"); $f->attr("value", $unpublishbuttontext); // add unpublish button after the save button if ($page->status == 1) { $form->insertAfter($f, $form->get("submit_save")); } } } } Everybody who is interested can download the modul here: CustomPageSaveAndUnpublish.zip Best regards Jürgen
    1 point
  13. This module provides a very simple interface to a set of named counters. You simply call a single function, next('name'), to pull the next value out of a counter - or to set it up if it does not yet exist. Next() takes a few extra parameters to allow you to increment by values other than 1 or to start at a certain number. This provides some similar functionality to the built-in page naming feature of PW, and to this module recently posted by Stikki but I think it offers a little more flexibility than either. Having said that, I do like the simplicity of Stikki's new auto-increment module. Module Availability Here is my module on Github. Here it is in the module repository. Example Usage Here's how this module can be used to title and name a new page by adding a couple of simple hooks to site/ready.php. This example applies to new pages using a template called 'invoice' that can be quick-added to the page tree. In order to get the following to work, you must edit the template that will be the parent of the 'invoice' template and setup the template for children to "invoice" and set the "Name Format for Children" field to something other than the default blank value (I use title as my value.) <?php /** * Function to recognise our special template. */ function isInvoiceTemplate($template) { return ($template == 'invoice'); } /** * Pre-load the page title for invoice pages with a unique value * which includes a counter component. */ $pages->addHookBefore("Pages::setupNew", function($event) { $page = $event->arguments(0); $is_invoice = isInvoiceTemplate($page->template); $no_inv_num = $page->title == ''; if ($is_invoice && $no_inv_num) { $counter_name = 'WR-' . date('Y'); $number = $this->modules->get('DatabaseCounters')->next($counter_name, 10, 5000); $page->title = $counter_name . '-' . sprintf("%06u", $number); } }); /** * Prevent ProcessPageEdit from forcing an edit of the name if we got here * through a quickAdd from ProcessPageAdd. We can do this because we * preset the title field in the Pages::setupNew hook. */ $pages->addHookAfter("ProcessPageEdit::loadPage", function($event) { $page = $event->return; $is_invoice = isInvoiceTemplate($page->template); $is_temp = $page->hasStatus(Page::statusTemp); if ($is_invoice && $is_temp) { $page->removeStatus(Page::statusTemp); $event->return = $page; } }); Note, the above code + module is one direct solution to the problem posted here by RyanJ. Version History 1.0.0 The initial release.
    1 point
  14. Just a follow up here. The module works perfectly fine with the method above if you make sure you add the template to its settings DUH!!
    1 point
  15. Yeah, tried it before. Didn't work because of my spelling mistake (Team_Photo vs. Team_Foto). Now this works too. This was too much information for me today. Again, thanks for your help and patience. Also thanks to DaveP and Christophe!
    1 point
  16. No need to duplicate any code here. The foreach is there to run multiple times on it's own. <div class="uk-grid uk-text-center team-thumbnails"> <?php foreach($page->Teammitglieder as $member): ?> <div class="uk-width-1-5 uk-container-center"> <img class="uk-thumbnail uk-border-circle" data-uk-modal="{target:'#<?php echo $member->id; ?>'}" src="<?php echo $config->urls->templates?>layout_images/g.wertich.jpg" width="130" height="130" alt="$image->description" alt=""> <div class="uk-thumbnail-caption"><?php echo $member->Team_Name; ?></div> <a class="more-infos" href="#<?php echo $member->id; ?>" data-uk-modal>Mehr Infos ...</a> </div> <?php endforeach; ?> </div> <!-- And later --> <?php foreach($page->Teammitglieder as $member): ?> <div id="<?php echo $member->id; ?>" class="uk-modal"> <div class="uk-modal-dialog"> <a class="uk-modal-close uk-close"></a> <div class="uk-modal-header"> <h2><?php echo $member->Team_Name; ?></h2> <img class="uk-thumbnail uk-border-circle team-detail" src="<?php echo $config->urls->templates?>layout_images/g.wertich.jpg" width="100" height="100" alt="$image->description" alt=""> </div> </div> </div> <?php endforeach; ?>
    1 point
  17. Lister Pro is purchased!
    1 point
  18. Hi biber, There's quite a number of ways to achieve this. Here's a couple for starters: https://processwire.com/talk/topic/2475-quick-tip-for-testing-on-live-website/
    1 point
  19. Here you can see the basics to implement additional buttons: https://processwire.com/talk/topic/12174-module-to-add-2-additional-save-buttons-and-unpublish-button-to-page-edit/
    1 point
  20. Fantastic module. Thank you.
    1 point
  21. Adrian, I am sorry for misleading you with the 90% figure. It just describes my success in transferring Drupal data to ProcessWire in an automated way. The BCE module (thanks for that) is doing 100% what it should, the field pairings work great. My missing 10% is that I have to unwrap Drupal field collections into single fields for ProcessWire. I can do that probably on the CSV side and split the columns into fractions.
    1 point
  22. I'd like to thank LostKobrakai for this excellent tutorial included in the Dec 25, 2015 blog post regarding custom page types. If you haven't read it yet, please do so. It is contributions like this by the senior members that prove selecting ProcessWire was the correct decision for this ProcessWire-Newbie. I am impressed at what I have learned within the functionality of ProcessWire, and discovering avenues I hadn't yet thought about. It is indeed a merry Christmas. I also want to thank all staff members. They deserve our gratitude for the time they dedicate to helping us learn ProcessWire, and the many avenues available with each project. For example, kongondo contribution is another great example of the team in place here. My hat is off to Ryan and his team for giving of their time and sharing their knowledge. In addition to the regular staff, there are many members, such as Kixe, Tom, (and too many others to name them all here) that also deserve recognition for their contributions and assistance. It is greatly appreciated. I am certainly looking forward to ProcessWire 2016 ;-)
    1 point
  23. Hi Steffen, thanks a lot for your help, this solved my problem. Günter
    1 point
  24. This week I've got to keep the blog post a little brief because I've been so caught up in this weeks' updates that I've run out of time to write much in the post! The updates this week are not actually to the core code, but rather to the API reference documentation for ProcessWire 3.x. There's lots more work to do still, but I definitely have a good start, so going to introduce it here in this post. https://processwire.com/blog/posts/processwire-3.x-api-reference/
    1 point
  25. Hi Gazley, I'm not sure if I fully get what you are after, but I try to answer. You can access an Imagesizer instance like this: $ImageSizer = new ImageSizer(); // or, maybe better, with an image-filename $filename = $page->images->first()->filename; $ImageSizer = new ImageSizer($filename); Now you can query everything you want: https://github.com/ryancramerdesign/ProcessWire/blob/devns/wire/core/ImageSizer.php#L312-L321 https://github.com/ryancramerdesign/ProcessWire/blob/devns/wire%2Fcore%2FImageSizerEngine.php#L1110-L1131 https://github.com/ryancramerdesign/ProcessWire/blob/devns/wire%2Fcore%2FImageSizerEngine.php#L205-L216 $quality = $ImageSizer->quality; // returns the calculated value from: engine-default-setting => wire/config.php => site/config.php EDIT: Or do you mean the new modules configurable default settings of the ImagesizerEngines? If yes, you can use the $modules method getModuleConfigData() $configdata = wire('modules')->getModuleConfigData('ImageSizerEngineIMagic'); $defaultQuality = $configdata['quality'];
    1 point
  26. Hi biber, I had some time to oversee the code again, finally. I made two adjustments: The first was to remove the "echo </li>" from the second function in the visit call and add a </li> to the end of the output of the first function. Thats what I was hinting at before. The second was that I wrapped the nested lists inside another list-item <li> because of the HTML specifications for lists: http://www.w3.org/TR/html5/grouping-content.html#the-ul-element For comparison the working visit call: (with additional <ul> tags around so this can stand for its own) echo "<ul>"; visit( $pages->get('/') , function(Page $page) { echo '<li><a class="men" href="' . $page->url . '">' . $page->title . '</a></li>'; if ($page->numChildren > 0) { echo '<li><ul>'; } } , function(Page $page) { if ($page->numChildren > 0) { echo '</ul></li>'; } } ); echo "</ul>"; best wishes Steffen
    1 point
  27. This seems to be a great Lorem Ipsum type of module AutoContent generator by adrian https://processwire.com/talk/topic/11016-autocontent-generator/
    1 point
  28. Marvin Scharle responded to my mail on 11 Dec 2015 about PW3 support: Looks like the project/service is unmaintained.
    1 point
  29. Another way you could do this (code style may not be to your taste): <?php $pagesWithImages = $pages->find("filter_image!=''"); ?> <?php foreach($pagesWithImages as $p): ?> <?php foreach($p->filter_image as $filter): ?> <div class="filter-box" style="background-image: url(<?= $filter->url ?>);"> <div class="uk-overlay uk-overlay-hover uk-position-cover"> <div class="uk-overlay-panel uk-position-cover uk-overlay-background uk-overlay-fade uk-flex uk-flex-center uk-flex-middle"> <a class="hover-btn" href="<?= $p->url ?>"><?= $filter->description ?></a> </div> </div> </div> <?php endforeach; ?> <?php endforeach; ?
    1 point
  30. If I'm not wrong... <?php foreach($page->team as $member): ?> goes hand in hand with <?php endforeach; ?> and allows you to put html code between them, without needing to echo it for instance. It could be that here <ul class="modal-list"> <?php foreach($member->tasks as $task){ echo "<li>$task->description</li>"; } </ul> ?> is missing between } and </ul>. Or that you have to remove <?php NB: I could be wrong, I'm a beginner at PHP...
    1 point
  31. These are doing the same just with different syntax: <?php foreach($array as $item){ echo "<h1>test</h1>"; } ?> <?php foreach($array as $item) : ?> <h1>test</h1> <?php endforeach; ?> The ?> does only convey that the following code is not php code anymore. It does not end anything else.
    1 point
  32. If you have team members in a repeater called, say, team, they would be accessible through the API via a foreach(). Something like this- <dl> <?php foreach($page->team as $member){ echo "<dt>$member->name</dt>"; echo "<dd>$member->phone</dd>"; } ?> </dt> Note the bonus suggestion of using a definition list.
    1 point
  33. You can make it work with pagination, but it's a bit different to execute. // This part cannot use pagination, because we need all of john's comments, // but the whole selector construction is cacheable to minimize load // invalidate the cache whenever john does post a comment // optionally you can then also recreate the selector, so the waiting time // does hit John and not other users $johns = $pages->find("template=comment, comment_username=John"); $parents = $johns->explode(function($c){ return $c->parent->id; }); $parents = array_unique($parents); $commentsSelector = array(); foreach($parents as $parent){ $johnsFirstComment = $johns->find("parent=$parent, sort=created"); $commentsSelector[] = "afterjohn=(template=comment, parent=$parent, created>$johnsFirstComment->created, comment_username!=John)"; } $commentsSelector = implode(', ', $commentsSelector); // End cacheable $pages->find($commentsSelector . ', sort=created, limit=10');
    1 point
  34. Hello! Thank you for mentioning! I'm the author of Gor, feel free to ask any questions.
    1 point
  35. Check if the module AdminRestrictBranch can help you: https://processwire.com/talk/topic/11499-admin-restrict-branch/
    1 point
  36. A bit of history: PageTable is part of the ProFields. Thanks to Avoine (the sponsors) it has been made available as a free ProField. Here's a link to more info about the different ProFields, thanks to a question by @cstevensjr
    1 point
  37. Thanks for your answers! The first think i had to do, was enable the url segments. That was unclear for me. I asked a colleague for help. We looked at the example above and get it to work. $download = ($input->urlSegment1 == 'download'); $file = $page->bildarchiv_images; $thumb = $page->bildarchiv_thumb; if ($download) { $downloadFilename = '';// ($page->title).'.'.substr(strrchr($file->$filename, "."), 1); wireSendFile($file->filename(), array('forceDownload' => true, 'exit' => true, 'downloadFilename' => $downloadFilename)); } else { echo '<div id="basic-site-text" class="row content-box">'; echo '<div class="medium-9 columns content-box-column-left">'; echo "<h2>$page->title</h2>"; if($thumb) echo "<a href=\"./download/\"><img src='$thumb->url'></a>"; else echo "<a href=\"./download/\"><img src='$file->url'></a>"; echo "<p><strong>Stichwörter:</strong><br>$page->stichwoerter</p>"; echo "<p><strong>Copyright:</strong><br>$page->copyright</p>"; echo "</div>"; echo '<div class="medium-3 columns content-box-column-right">'; echo "<a id='search_submit' class=\"expanded button\" href=\"./download/\">Download</a>"; echo "</div>"; echo "</div>"; }
    1 point
  38. None that I know of. Are you sure you have that file in the right place? Edit the template for your order pages in PW. Click on the title (invoice number) field and, on the input tab, set the visibility to whatever you need.
    1 point
  39. To extend the above example to hide the name, template and parent fields on the settings page of invoices, you can add the following to the ready.php snippet in the above post. /** * Work out if the template's settings should be tweaked to hide things that should be fixed... */ function shouldHideTemplateSettings() { // Super users retain super-setting-edit powers if (wire('user')->isSuperUser()) { return false; } // Are we even editing a page? if (wire('page')->process != 'ProcessPageEdit') { return false; } $id = (int) wire('input')->get('id'); if (!$id) { return false; } $editedPage = wire('pages')->get($id); if ($editedPage->template->flags & Template::flagSystem) { return false; } if (!isInvoiceTemplate($editedPage->template->name)) { return false; } return true; } /** * Hide some fields from the invoice settings page from non-super-users. * * There's not much point allowing edits to the name field, so we want it immutable (at least) and probably totally * hidden (better.) * * We don't want invoices being moved from their parent, so we hide the parent field. * We don't allow them to use a different template, so we hide the template field. * */ if (shouldHideTemplateSettings()) { $pages->addHookAfter("ProcessPageEdit::buildFormSettings", function($event) { $wrapper = $event->return; // To show the name field but make it immutable $wrapper->_pw_page_name->collapsed = Inputfield::collapsedNoLocked; $wrapper->_pw_page_name->description = ''; // Alternatively, to hide the name field do uncomment the following and comment out the 2 lines above //$wrapper->_pw_page_name->collapsed = Inputfield::collapsedHidden; // Hide the template changer, invoices can only use the invoice template $wrapper->template->collapsed = Inputfield::collapsedHidden; // Hide the parent page, as it is fixed in our page structure $wrapper->parent_id->collapsed = Inputfield::collapsedHidden; }); }
    1 point
  40. @BernhardB - looks good, but I would like to know if there are any advantages over Soma's Helper Field Links: https://processwire.com/talk/topic/421-helperfieldlinks-field-and-template-edit-shortcuts/ which also provides links to edit fields and templates, as well a lots of info on the settings right there in the Inputfield. Please don't this as a criticism - honestly curious, and also making sure you already know about the other module.
    1 point
  41. A very simple tip, but that might be useful for someone that didn't think of it... This is what I usually do if I want to change something on a live site. if($user->name!='diogo'){ // live code }else{ // my new code } Like this I'm the only one that sees the changes. More examples: // test new javascript. do the same for styles <?php if ($user->name!='diogo'){?> <script src="<?php echo $config->urls->templates?>scripts/main.js"></script> <?php }else{?> <script src="<?php echo $config->urls->templates?>scripts/main-dev.js"></script> <?php }?> // test new head file if($user->name!='diogo'){ include(head.inc); }else{ include(head-dev.inc): } and so on... edit: corrected the first block by Nik's suggestion
    1 point
  42. So hi another question for you. I did my first page bootstrap and ProcessWire almost finished. The next page I want to do with files of ZURB Foundation and the compiled CSS. In the system before, there was to a finished module. This is available for PW Yes net and I would therefore incorporate Foundation itself. With normal data not a problem but with SASS already. How should we proceed so that the PW CSS files always kompliert and then stores? Would be grateful for tips and suggestions as I am not a PHP programmer. Thanks for help Chris
    1 point
  43. If you think about the /site/templates/ folder as if it is the root of a static html site, then it is easier to see what happens. When I use sass, I have a scss folder somewhere on the site (it can be within templates, or elsewhere, it doesn't matter). I then compile the main scss file and output it in /site/templates/css/ as something like site.css. Then your templates in your templates folder simply reference that file. I personally use Prepros, but there are a lot of systems out there.
    1 point
  44. Hi taqtaq, you could use Ryans sitemap-template. it works pretty good in different languages. No need to install LanguageLocalizedURL. For your different languages you should just add something like: <url> <loc>http://yoursite.fi/</loc> <xhtml:link rel="alternate" hreflang="en" href="http://yoursite.fi/en" /> <xhtml:link rel="alternate" hreflang="it" href="http://yoursite.fi/it" /> </url> http://processwire.com/talk/topic/3846-how-do-i-create-a-sitemapxml/ I will check if I could write a small function to implement this for every language in the system. EDIT: Here comes Ryans template with added language alternate-links like recommended by google for multilanguage support. more information here: https://support.google.com/webmasters/answer/2620865?hl=en important: name of language should be same like international language-code (name your pages en for english, de for german, es for spain etc. Just Follow Ryans instructions to use the template, everything else is done by the template. Update 29.02.16 This update is made for PW 3.0. To prevent endless redirects in 2.7 and lower please read instructions (comments). You need to comment out the line with the redirect. multilang-sitemap-xml.php.zip
    1 point
  45. I added this to the dev branch last week, so that you can now pass additional things to $page->render(): https://github.com/ryancramerdesign/ProcessWire/blob/dev/wire/modules/PageRender.module#L212 One of the things I wasn't thinking about before is that $page->render() was already capable of accepting an array of options (though not commonly used, mostly internal). So we weren't starting from a blank slate, and had to make something that was compatible and complimentary to what was already there. In terms of API calls, you can now do any of these: $page->render($filename); // $filename assumed in /site/templates/ $page->render($pathname); // $pathname is full path, but must resolve somewhere in web root $page->render($options); // array of options and/or your own variables $page->render(array('foo' => 'bar')); // same as above $page->render($filename, $options); // specify filename and options/vars, etc. The $options variable was already something that $page->render() accepted before. Only it was used to specify some little-used modifiers to render(). Those are still there (and they are necessary), but now the utility of $options has been extended. When you want to specify options (outlined in the link above) you only need to specify the ones you want to change from the defaults (of course). Typically you don't need to change them, so I'm guessing that most would use $options to specify their own variables. Every rendered template now receives a copy of that $options array locally scoped. That $options array contains any variables you passed to $page->render(). It also contains PW's default options, should you want to examine any of them. If you made this render() call: echo $page->render('myfile.php', array('foo' => 'bar')); myfile.php could access the 'foo' variable like this: echo $options['foo']; // outputs "bar" One other addition that I'm thinking people might like is $options['pageStack']. That is an array containing a stack of pages that called render(). So if you are doing any recursive rendering of pages, any template can access $options['pageStack'] to see what page is rendering it, and any others before it. Previously this was not possible, and the only way a template could tell what other page was rendering it (if any) was for that renderer to tell the renderee, via $mypage->caller = $page; or something like that.
    1 point
  46. The reason I like these kind of snippets so much is the freedom they offer. If you want to show the dev page to anyone that is logged in, change the conditional to: if($user->name='guest') If you want to give a special url like domain.com/?version=dev change it to: if($input->get->version!='dev') with the url version you can also make all the links work wth sessions like this: if($input->get->version!='dev' OR $session->version != 'dev') and inside the else: $session->version = 'dev';
    1 point
×
×
  • Create New...