Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/07/2016 in all areas

  1. u can.do theis too function starwar() { extract(wire('all')->getArray()); echo "may.the be force.wit u $user->name and alsos.wit $page->path"; }
    9 points
  2. HomeProductsProduct1Review-Product1 Product2Review-Product2 Product3Review-Product3 Contact --- The parent from "Review-Product1" is "Product1" The rootParent from "Review-Product1" is "Products"
    8 points
  3. Global variables are against the principle of object oriented programming. LostKobrakai made a good point. One could always write something like this: $_GLOBALS['page'] = "I'm a string page"; and your code breaks... If you're in a class derived from wire, the cleanest way to get the API variables is like this: $this->wire('page'); $this->wire('sanitizer'); // They could also be accessed directly, but then you're not 100% sure if the member is overwritten with something else $this->page $this->sanitizer The global wire function is there to access the API variables in (global) functions, or static methods when you're in a class. You don't even need to reassign them to local scoped variables, just use them like so: echo wire('page')->id; ... or if you really want local variables with a one liner, write a little wrapper like this: function getApiVars() { return array( wire('page'), wire('pages'), wire('sanitizer'), ); } // And then list($page, $pages, $sanitizer) = getApiVars(); Or another possibility would be to inject them into your class/method, if you don't subclass Wire. Cheers
    7 points
  4. $page->rootParent The parent page closest to the homepage (typically used for identifying a section) https://processwire.com/talk/topic/2911-why-does-page-rootparent-identify-current-section/ https://processwire.com/talk/topic/8326-getting-the-rootparent/
    7 points
  5. Greetings, A lot of you probably already know about this, but just wanted to post here because I think it's really neat. The New York Public Library has prepared a page with free access to 187,000+ historic images, all in high-resolution. Check it out... http://publicdomain.nypl.org/pd-visualization/ Thanks, Matthew
    6 points
  6. I purely use CKEditor for text and text only. And only allow a few HTML tags. Mostly h2, h3, h4, then p, strong, em, ul, li and a. I disable the pwimage, table and all other thing not related to pure markup text. All other content could be added with a page table field row. So if they need a form, a map, an photo album, a single photo or something else, they can add it via the page table. All rows of the table are looped and set to a variable. That variable is set to the template and rendered on the main view.
    2 points
  7. it also occurred to me I can do this, which is still shorter, but not so tidy: foreach(['pages', 'input', 'sanitizer'] as $w) $$w = Wire($w);
    2 points
  8. It's true that class collisions can happen, but pw 3.0 is moving to using namespaces for that reason. In turn variables are not namespaced. They are always bound to the scope or global. Wanze's helper method is probably a better way to go, kinda like extending Wire to get access to api variables in classes.
    2 points
  9. Use sort in the children method like this, assuming the date field is actually "date": if($page->hasChildren) { $content .= renderNav($page->children("sort=date"), array('ul'=>'article-index list clearfix', 'li'=>'article-index__item'), 'post_date'); }
    2 points
  10. SIX AND ONE => ALTI VE BIR => https://en.wikipedia.org/wiki/Trabzon_Province (I was born here) Vehicle registration code is : 61 and my company name. Living here : https://en.wikipedia.org/wiki/Marmaris since 1988
    2 points
  11. hi everyone, i'm happy to share my first little module that could have broader use... use at your own risk! i'm quite new to module development Usage Just install the module and place your preview images in the folder /site/templates/TemplatePreviewImages filename = template-name.png Github https://github.com/BernhardBaumrock/TemplatePreviewImages Notes jquery image picker used in this module (MIT license): http://rvera.github.io/image-picker/ Room for improvement / roadmap: Images are resized via CSS (height: 200px) Images could be placed via masonry or the like create image-field to upload preview images directly to the template looking forward to hearing your feedback ps: is it intentional that i am only allowed to choose from 2 templates when adding the page and have more options available when editing the template settings of the page like you can see in the video? i'm wondering why this should be like this?!
    1 point
  12. As described in this post (https://processwire.com/talk/topic/8551-custom-urls-for-pages/?p=82742) the option 'Name Format Children' under the tab 'Family' in template settings doesn't work properly and also not as expected. I had a look inside the code and made some changes which are working properly, which offers much more options, more consistency and less code too. The result is the following. You have 3 Options for generating name and title, which could be combined in endless variations. Name is always derived from title, same like creating pages manually. type date: if function detects # character anywhere in the string, conversion will be: deletion of # and string will be used as format parameter for PHP date() function type field: if string is a fieldname of the parent page the value of this field will be used type string: if string doesn't fit to the 2 preceeding it will be taken as it is All parts (separated by comma) will be composed in the order of setting. You can use unlimited numbers of parts I made a pull request on github: https://github.com/ryancramerdesign/ProcessWire/pull/831 Example screenshots Setting ... will result in
    1 point
  13. What it does: you can easily define replacement-tags in your fields (also descriptions) like this: [demo] => '<span class="demo">some demo markup</span>', [demo2] => '<span class="demo">some other demo markup</span>', [demo3] => '<span class="demo">one more demo markup with a <a href="#" class="pw-modal">modal link</a>!</span>', Screenshot: Why? today i had to (to be more precise: i wanted to) have a link in one of my field-descriptions that opened a modal to a list of icons... basically i just wanted to add a "pw-modal" class to the link what is not possible through markdown [link](http://example.com) i ended up with the following little module: // removed - please see the code on github its also on github: https://github.com/BernhardBaumrock/ProcessWireModules/blob/master/InputfieldTagReplacer.module i know but didn't use RuntimeMarkup because i wanted the link in the description not in a separate field! Questions: would it be possible to get the currently edited $page somehow? the $page object i get now is the admin page with the according process. it would be nice to be able to do things like $page->parent or the like... would there be another method to hook into that would be more efficient or better in any other way? how can i debug the $event object? i tried var_dump($event); die(); but that showed nothing var_dump($event->return); die(); shows the form/field markup would there have been an easier way to achieve this?
    1 point
  14. 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
  15. Sorry I got delayed with other stuff + sluggish coming off the holidays ...I'll put something up tonight or tomorrow morning....
    1 point
  16. We're actually using ckeditor with images and because on happygaia.com it's only me and my girlfriend I enabled full html, could be better but it's working okay so far
    1 point
  17. for reference here my very basic module to replace [tags] in description with any code: https://processwire.com/talk/topic/11208-inputfieldtagreplacer/
    1 point
  18. It depends on what I am doing. On article orientated sites I use CKEditor a lot in conjunction with Hanna code. So I might create code for spoilers or blocks and so on. It is all down to who is updating that part of the site and how much training they have. I never use it fully configured, however.
    1 point
  19. Do you have exactly the same string in $config->httpHosts and in your vhost configuration? ...and you can alway just leave $config->httpHosts empty to allow anything.
    1 point
  20. Merry Christmas to all celebrating according to Julian calendar! I want to share a little antimalware app made by Yandex - a Russian Google kind of thing (may be known to you as the inventors of BEM css class naming convention). Here is their promo site, here is github repo. Hope it will be of no use to us, PW users...
    1 point
  21. Thank your for taking the time to clear that up. I have been enlightened!
    1 point
  22. All the information is included in the trashed page's name. Otherwise there wouldn't be the option to restore trashed pages with the click of a button. It's just, that there's not a nice api present around that.
    1 point
  23. Because it breaks as soon as you're using any external code that uses these variable names anywhere. The WirePDF module for example does use mpdf as pdf rendering library. If this library is using $page as variable somewhere it's break your website. @Mike It's using the same object but it's still repetitive to use this snippet in each function or rewrite code from using variables to wire("var") when it's abstracted into a function.
    1 point
  24. Hi ngrmm, the value of a checkbox is 0 for unchecked and 1 for checked, so to have checked pages at the top, you have to sort in descending order. Simply prepend a - to the field: $articles = $pages->find('template=x|y, sort=-highlight, sort=creation');
    1 point
  25. @Jon Thanks for reporting. I fixed this. Please update to 1.0.9
    1 point
  26. Hello, Ive just installed this module but get the following error. Any Ideas? Error: Call to undefined function _() (line 56 of F:\Programs\wamp\www\tml\site\modules\ProcessSetupPageName\ProcessSetupPageName.module) This error message was shown because you are logged in as a Superuser. Error has been logged.
    1 point
  27. No problem, I followed exactly the steps on their website. $ git clone https://github.com/letsencrypt/letsencrypt $ cd letsencrypt $ ./letsencrypt-auto --help and then ./letsencrypt-auto certonly --webroot -w /var/www/example -d example.com This generates a .pem-File with the full certificate chain ("ssl_certificate") and a private key ("ssl_certificate_key"), both of which you enter in your nginx config – restart nginx and there you go
    1 point
  28. I have to hop in on this and portray my thanks to LostKobraKai and everyone else on this forum! Everyone is so helpful and (and luckily for me) ignores my dumb/simple questions to help me out. As someone still learning php and processwire, it can be overwhelming trying to achieve what is in my head with the limited knowledge that I have thus far.
    1 point
  29. I would add a field to the user template and set its timezone for every user page. as you did. then using horst´s example hooks and session public function init() { $this->pages->addHookAfter('Session::logout', $this, 'timezoneLogout'); $this->pages->addHookAfter('Session::login', $this, 'timezoneLogin'); } public function timezoneLogin(HookEvent $event) { $user = $event->object; $session = wire('session'); $session->timezone = $user->timezone; } public function timezoneLogout(HookEvent $event) { $session = wire('session'); $session->remove('timezone'); } Now you can use the session var across the backend and the frontend without querying the user
    1 point
  30. I'd create a function, where you pass in the page and it returns the meta data. In the function I'd simply use a switch statement to change up the output depending on the template. With that you can have nice defaults, but also the option to customize when needed.
    1 point
  31. Done. Renamed the module to ProcessSetupPageName and added it to the modules directory. http://modules.processwire.com/modules/process-setup-page-name/
    1 point
  32. I double the thanks! I think LostKobraKai's posts around the forum are a damn awesome source of learning, short elegant code filled answers right in your face! But certainly can't stop thanking here, there is so much talented and experienced people giving away so much valuable advice, I had forgotten how important a community can be when learnimg new stuff. And no, I'm no that drunk yet! But already feeling sentimental lol
    1 point
  33. Hey kixe, Thank you - this is awesome and solves one of my biggest issues with PageTable fields - getting meaningful page names without the possibility of conflicting names which I don't think the user should ever have to consider. One minor thing (but critical) - when installing with PW 3.x I get this error: Catchable fatal error: Argument 1 passed to ProcessWire\Pages::__construct() must be an instance of ProcessWire\ProcessWire, none given, called in /wire/core/Modules.php on line 481 and defined in /wire/core/Pages.php on line 128 It is easily fixed by adding an empty construct method to your module, like this: public function __construct() { // intentionally empty } I am definitely looking forward to using this with all my PageTable fields!
    1 point
  34. Hello. You can try to switch off ACF ("No") and check what you get. But also here is another working solution (in two 2 steps): 1. in site/modules/InputfieldCKEditor create newstyles.js with content: CKEDITOR.stylesSet.add( 'newstyles', [ { name: 'Left aligned', element: ['address', 'p', 'ul'], attributes: { 'class': 'left' } }, { name: 'Right aligned', element: ['address', 'p', 'ul'], attributes: { 'class': 'right' } }, { name: 'Read more button', element: ['a'], attributes: { 'class': 'button' } } ]); 2. inside field settings need to set this: - Use ACF: No - Custom Editor js Styles Set: newstyles:/site/modules/InputfieldCKEditor/newstyles.js NOTE: After this, you will see dropdown list of additional classes only when you inside editor select tag from the list (address, p, ul, a). Regards.
    1 point
  35. I've updated renderList to include the pagerOptions here too in the dev branch. I've got to be honest and say that arrays in GET vars have always bothered me. They are so darn verbose and ugly. Why have a query string like this: var[]=1&var[]=2&var[]=3 When you can do this: var=1,2,3 All it takes is encoding your array like this: $input->whitelist('var', implode(',', $var)); and decoding it like this: $var = explode(',', $input->get->var); That's just my preference anyway, but not suggesting it should be anyone else's unless these things also keep you up at night.
    1 point
×
×
  • Create New...