Jump to content

szabesz

Members
  • Posts

    2,960
  • Joined

  • Last visited

  • Days Won

    20

Everything posted by szabesz

  1. Thanks for educating me, teppo! I have never used GitHub (apart from downloading ZIP files and simple browsing) nor noticed the "forked from" line. Sooner or later I need to find the time to familiarize myself with GitHub, I suppose. And again, sorry for the off-topic question.
  2. Is it possible that you are using it on a live site or at least a publicly accessible server and not your local machine?
  3. Thank you for the answer! Is it also standard not to reflect this in README.md and just copy it over? I mean, how can one tell apart the various forked versions? Just by looking at the "main pages" of the projects, they seem identical to me. Sorry if it happens to be an off-topic GitHub question.
  4. May I ask why it is a good idea to fork it, instead of including these features in the original module? Am I missing something perhaps? I'm not a GitHub guru, so I ask: doesn't it mean that these are two completely separate projects from now on?
  5. @Soma: Thank you for the detailed tip! I think it is more versatile than what we have came up with so far. As far as I can tell, your render method example covers the particular use case we dealt with in this thread and surely with even more helper methods added to the class all sorts of utilities can be implemented.
  6. Hi, If I understand the issue correctly, you might want to check out these modules, so that you can show the default: http://modules.processwire.com/modules/template-notes/ http://modules.processwire.com/modules/fieldtype-runtime-markup/ http://modules.processwire.com/modules/inputfield-textarea-markup/
  7. I do not know too much about opcache, however I think is important to point out that whenever I use it I notice that when updating files the cache is not immediately refreshed but it takes several seconds (somewhere between 0-30) to be able to see the changes being applied. So in my experience opcache makes testing code changes painful during development.
  8. So this is a nice example of the confusing nature of any "long-do-this-or-that" interface constructs. I never liked them. They are used all over the place (tv front panel controls, watches, touch screen devices) but it does not mean it is an intuitive control method. Luckily the virtual screen of a computer is not limited to a few number of buttons, so I do not understand why this confusing way of controlling things should be used at all.
  9. I should have thought that you are also working while traveling Thanks again for one of the most useful modules and for the blog post as well!
  10. To simplify it a biny bit: function addClass($element, $class) { $classes = wire('classes'); $classes[$element][] = $class; wire()->wire('classes', $classes); } Anyway, thanks a lot bernhard! When reading LostKobrakai's comment, I was also wondering how we can we use it any context, but I did not spend the time to figure it out on my own
  11. When the administrator should be able to change settings, your solution works fine, however, adding our own standard classes to HTML elements is a different problem I think. bernhard wants to create a collection of HTML classes which can be easily applied to an element, and normally we do not want the administrator to change these values. Building these collections the beginning of the template file is good idea.
  12. @bernhard: Seems to work. Can you please test it? function addClass($element, $class) { $classes = wire('wire')->classes; $classes[$element][] = $class; wire('wire')->wire('classes', $classes); }
  13. I am still trying to figure out if there is a way to access the wire object directly "from anywhere", but we can pass its reference to the function to make it work: function addClass($element, $class, $api_vars) { $classes = $api_vars->wire('classes'); $classes[$element][] = $class; $api_vars->wire('classes', $classes); } so in a template: addClass('tm-main', 'tm-blog', $this->wire); Just a sidenote: I do not think $api_vars->wire('classes', $classes); is needed since $classes contains a reference to the object and by doing $classes[$element][] = $class; we actually change the object so no need to store $classes once more. Edit: I have just tested it, and we do need the above, sorry!
  14. Hi boys, First of all, it is not early morning, so I got back to this one bernhard wrote: "using PW 3.0.12 it did not work with the example of tpr above using wire(x, y) without $this..." Actually, this has nothing to do with PW version, since $testArr is just a local variable, in the scope of the template and not related to the wire object. This way $testArr is not stored as an API variable. To append it to the wire object, we do need to access it via $this. See public function wire($name = '', $value = null, $lock = false) in /wire/core/Wire.php. The function wire($name = 'wire') in /wire/core/Functions.php can only retrieve variables but it cannot set them. So wire('testArr', array()); has no effect. The code only works, because we are dealing with variables in the same scope. Correct me if I'm mistaken, but I cannot come up with another explanation.
  15. @Martijn Geerts: Yeah, although these naming conventions are logical, it is easy to get confused sometimes. @tpr: Actually, I was drinking my coffee why fiddling with the above code, but doing these two activities at the same time made things worse, I suppose
  16. Isn't it possible to bundle two versions of Tracy and use the one appropriate? Too much work maybe?
  17. Oh, my, I mixed up /site/templates/_init.php and /site/ready.php just because the latter was open in my IDE and I used that.... Sorry for this! Sure, in _init.php the variable is available thanks! Now I have a few posts to edit
  18. Sorry, I forgot to specify that it is in the template where $testVar is undefined. (I'm gonna edit the post...)
  19. EDIT: anyone reading this, please note that the variable was undefined because instead of _init/php I used ready.php accidentally, see: https://processwire.com/talk/topic/12198-modifying-config-property-eg-sitesettings-from-readyphp/?p=116746 Thanks tpr, What we are after is this (at least I am ) : //_init.php $testVar = new \stdClass(); $testVar->myArray = array( 'hello' => 'world' ); wire('testVar', $testVar); // home.php (or elsewhere) echo '<pre>'; var_dump($testVar); echo '</pre>'; This results in "PHP Notice: Undefined variable: testVar in..." in home.php
  20. I could not make use of $this->wire('variableName', $obj); in my template files either, because as bernhard has pointed out, it is not possible to modify the variable. So I ended up using this: use ArrayObject; $sbs_globalData = array( 'block_counter' => 1, ); $sbs_globalArrayObject = new ArrayObject($sbs_globalData, ArrayObject::ARRAY_AS_PROPS); $config->sbs_globals = $sbs_globalArrayObject; However, I am also interested in utilizing WireArray instead.
  21. You can download old releases from GitHub: https://github.com/ryancramerdesign/ProcessWire/releases However, if the site is ok on your localhost server, then I do not think it is a good idea to downgrade because sooner or later you will need to solve this problem anyway. So you online server is running PHP Version: 7.0.2. You might want to try switching to PHP 5.6.x. As far as I know ProcessWire runs on v7 too, but you have modules as well which might not yet be PHP 7 ready. Even if your xampp is configured to run PHP 7, you might want to try downgrading PHP. BTW, how about the server logs?
  22. Just a sidenote: https://processwire.com/api/variables/user/ and: http://cheatsheet.processwire.com/user/user-properties/user-pass/ And thanks to kongondo: http://kongondo.github.io/ProcessWireAPIGen/devns/class-ProcessWire.Password.html
  23. Hi, Since you wrote: "my internet speed is not very good" I thought we are talking about an online server, not your localhost. Xampp is running on your machine, so why should internet speed matter too much? Anyway, suhosin cannot be an issue in the case of running on Xampp. "but sometimes it is not working while I am updating the content" Can you please explain it in a bit more detail? Referring to images made me think you cannot upload them, but I'm not so sure. Can you please clarify?
  24. I recommend using kongondo's ApiGen Docs, for example 3.x: http://kongondo.github.io/ProcessWireAPIGen/devns/class-PageArray.html Ryan's doc pages should be considered "for introduction purposes only". We cannot expect him to keep it up-to-date
  25. Wow! Thanks for sharing, BitPoet! I suppose it works with 2.7.x and 3.x too, right?
×
×
  • Create New...