-
Posts
2,924 -
Joined
-
Last visited
-
Days Won
19
Everything posted by szabesz
-
modifying $config property (e.g. siteSettings) from ready.php
szabesz replied to Macrura's topic in General Support
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 -
modifying $config property (e.g. siteSettings) from ready.php
szabesz replied to Macrura's topic in General Support
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. -
modifying $config property (e.g. siteSettings) from ready.php
szabesz replied to Macrura's topic in General Support
@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); } -
modifying $config property (e.g. siteSettings) from ready.php
szabesz replied to Macrura's topic in General Support
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! -
modifying $config property (e.g. siteSettings) from ready.php
szabesz replied to Macrura's topic in General Support
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. -
modifying $config property (e.g. siteSettings) from ready.php
szabesz replied to Macrura's topic in General Support
@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 -
Isn't it possible to bundle two versions of Tracy and use the one appropriate? Too much work maybe?
-
modifying $config property (e.g. siteSettings) from ready.php
szabesz replied to Macrura's topic in General Support
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 -
modifying $config property (e.g. siteSettings) from ready.php
szabesz replied to Macrura's topic in General Support
Sorry, I forgot to specify that it is in the template where $testVar is undefined. (I'm gonna edit the post...) -
modifying $config property (e.g. siteSettings) from ready.php
szabesz replied to Macrura's topic in General Support
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 -
modifying $config property (e.g. siteSettings) from ready.php
szabesz replied to Macrura's topic in General Support
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. -
Processwire admin interface is not working properly in my server
szabesz replied to saboor's topic in Getting Started
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?- 15 replies
-
- Procash
- slow admin interface
-
(and 1 more)
Tagged with:
-
how to compare a password for changing password ?
szabesz replied to adrianmak's topic in API & Templates
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 -
Processwire admin interface is not working properly in my server
szabesz replied to saboor's topic in Getting Started
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?- 15 replies
-
- 2
-
- Procash
- slow admin interface
-
(and 1 more)
Tagged with:
-
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
-
Wow! Thanks for sharing, BitPoet! I suppose it works with 2.7.x and 3.x too, right?
-
Thanks for the answers adrian, Christophe and teppo! I also think "blocks to create unique page structures on the fly" is the right answer. However, in this case Concrete5 is NOT one step above ProcessWire in this area, because we are talking about two completely different concepts regarding frontend development, so they should not even be compared in this manner I think. Maybe that is why I didn't get close to decoding this sentence
-
Can someone explain this to me? "Concrete5 is one step above Processwire in terms of on-the-fly Web-page adaptation." I'm interested in this "on-the-fly Web-page adaptation" which I do not seem to decode. And just to comment on this: "version 5.7, which proved to be incompatible with previous versions. In other words, a site built with version 5.6 cannot easily be upgraded." I chose ProcessWire to avoid this sort of issue in the first place. We have to spend too much time upgdating things anyway...
-
Anyone successfully added CKEditor shortcut keys?
szabesz replied to Robin S's topic in General Support
Thank you for sharing, Robin S! -
Processwire admin interface is not working properly in my server
szabesz replied to saboor's topic in Getting Started
Hi saboor, Your current issue reminds mi of this one: https://processwire.com/talk/topic/12375-urgent-will-pay-help-debugging-image-fields/ Personally I have never run into this suhosin issue, but it sound very similar to me. If it will not help, you might want to share more info regarding server environment, PHP version, ProcessWire version, possible 3rd party modules, etc.- 15 replies
-
- Procash
- slow admin interface
-
(and 1 more)
Tagged with:
-
+1, so I completely agree. However, just for reference, in addition to "Simple website tutorial" by Joss there exists the old wiki which is still good for beginners (thanks to the fact, that the basics do not change, another thing I do like a lot in ProcessWire): http://wiki.processwire.com/index.php/Category:Long_Tutorials
-
Whether a PDF file is downloaded or not depends on server configuration or browser settings and maybe on transferring the document files through PHP should it be the case. eg.: https://www.devside.net/wamp-server/forcing-a-pdf-or-doc-to-open-in-browser-rather-than-downloading Personally my Safari is set to force the download of any PHP file by turning off the viewer plugins. So you might need to check the client's setup as well.
-
Thanks Ivan for bringing it up! I must have missed it, but now it is 93 as I added my own "like" to it (an obviously someone else too).
-
Thanks for sharing anyway