Wanze
PW-Moderators-
Posts
1,116 -
Joined
-
Last visited
-
Days Won
10
Everything posted by Wanze
-
If we add a link in the pointed thread to this one, we'll get recursion
-
Hi Joe, See here: https://processwire.com/talk/topic/4553-how-do-i-get-a-list-of-online-users/ It should be possible to get a list of online users. You then need a Hook for example on this method: https://github.com/ryancramerdesign/ProcessWire/blob/dev/wire/core/Session.php#L311 Return false if there is already a user logged in.
-
Have you checked my solution? It works. I have a site with > 200.000 pages each containing images and files. One big disadvantage is that I needed to hack two core files. I'll open a GitHub issue with a proposal how this could be implemented with hooks. If you take a solution like mine, you'd need to write a script which creates the subfolders and moves the files for your existing site. So for example: files/1603/image.jpg must be translated to: files/16/03/image.jpg
-
One template doesn't recognise any paths, but one works fine
Wanze replied to JohnHalsey's topic in General Support
Hi JohnHasley, Grab a coffee and provide some code please, we can't help without more information If you open your console you should see the resources that won't load. What error code do you get? -
if ($user->language == "default") { Your if statements won't work because $user->language is a Language object. So you could try: if ($user->language->name == 'default') // Or if your values are titles rather than names if ($user->language->title == 'francais')
-
I just tried 40 minutes to connect to a DB server via a python script, always getting errors that no host is available.... until I finally realized, that the IP used was not public and I needed a VPN connection first.
-
@Manaus, Please take a look at some posts before, this solution may help: https://processwire.com/talk/topic/1609-processgoogleanalytics/?p=55523 @all I just updated the module to 1.2.1 which fixes the issue with the dates in the header with the new admin theme from 2.4. Looking at my code, I realized that this will need some refactoring if I finally find time (most likely during summer holidays). However, the fact that everything still works speaks very much for ProcessWire @MadeMyDay Could you solve the problems? I just installed on a brand new dev version of Pw and everything was working as expected. Cheers
-
Problem creating new page from API with custom field with a float subfield
Wanze replied to adrian's topic in API & Templates
You're welcome. I think Ryan did some work on the float fields - there was a problem that float values were "cut down" to integers due to the local set by PHP, if multilang support was enabled. Maybe something changed how an empty value is handled too. Cheers -
Problem creating new page from API with custom field with a float subfield
Wanze replied to adrian's topic in API & Templates
I think it should work if you initialize the values with zero here: https://github.com/ryancramerdesign/FieldtypeMapMarker/blob/master/MapMarker.php#L33 -
When i run into problems with the GA Api it was usually due to Curl, that was somehow configured wrong or different. Could you try if it maybe works after trying this here: http://processwire.com/talk/topic/1609-processgoogleanalytics/?p=43877 Otherwise I think you'd have to debug directly in the code and check if Google returns any error codes from the queries. Tell me if I can help you there. I will update the module and add the date range as main header rather than h2, which gets messed up with the new admin theme.
-
Hi, Does this answer on stackoverflow solve your issue? I guess it should: http://stackoverflow.com/questions/18677244/error-invalid-client-no-application-name Cheers
-
Don't understand the question exactly, but here are some nice docs: http://processwire.com/api/fieldtypes/repeaters/ Also repeater pages have a special template called "repeater_yourField". So theoretically you could also get repeater pages the following way: // Get last item sorted by created DESC $item = $pages->find("template=repeater_yourField,sort=-created,limit=1"); // Get first item sorted by created with an additional condition $item = $pages->find("template=repeater_yourField,sort=created,field|field2%=blub,limit=1");
-
There is a 404Exception throwed if you visit pages where no template-file is existing. Does the template of your child pages have a template file associated, e.g. template.php in /site/templates/?
-
Depends on your knowledge. The Database design of ProcessWire is pretty easy, so if you know MySQL you should be fine. Another possibility is to build your reports only in small steps, e.g. with fixing the limit selector and increasing the start selector. This way you only query a subset of the data which you sum up or cache. Creating reports from data is usually done separately e.g. you could copy your database and generate your reports from the copy. This ensures that you don't have any performance issues for the regular website users. But maybe this is not necessary. Still I would generate the reports maybe with a command line script. If you need to create them regularly, you could also use a cronjob for this
-
You need double quotes "". Also I guess the new line is visible when translating the string in the Pw admin. To get a new line in html, you need the br tag: <h2><?php echo nl2br(__("first line\nsecond line"));?></h2>
-
Hi yesjoar, Not sure about the trackChanges as Valery mentioned. But if output formatting is off, then Pw returns an array of images regardless of your max image setting. $p->setOutputFormatting(false); $image = $p->image->first(); $image->description = "Test"; $p->save() $p->setOutputFormatting(true);
-
What is your setting for the amount of max images in your avatar field? If it is set to "1", then (if outputformatting is on) Pw returns directly the PageImage object - NOT the PageArray. So you could try this: $user->avatar->getThumb('thumbnail');
-
You're welcome. It depends on your needs. But as written in the introduction, the easiest is to use the "Language Support Pages Names" module. The great advantage is that you have one site tree for as many languages as you need. So in your case, each page of your site is created once and then you add the content in german and english. The fact that you can also define which page is published in which language makes it even more flexible
-
Hi, Here you go: http://processwire.com/api/multi-language-support/multi-language-urls/
-
Hi mvdesign, Not sure I understand you correctly. But also when uploading with a "Jquery Uploader", the files are processed somehow server-side (PHP). And in PHP, accessing the uploaded files is done over the $_FILES array. Anyway, if the files are stored in a directory on your server, you can attach them to your pages like this. Note that this is code written in the browser and not tested. You can attach multiple images for example by looping through the files in your directory. $p = $pages->get('/path/to/my/page/'); $image = '/path/to/my/image.jpg'; $p->of(false); $p->images = $image; $p->save(); $p->of(true);
-
Best practice: Where to store functions to generate page output
Wanze replied to chrizz's topic in API & Templates
If you need the function multiple times in different contexts (templates, modules... etc.) then you can write a simple module. Calling a method in your module goes like this: $myModule = $modules->get('MyModule'); echo $myModule->myFunction(); Advantage: You have access to your module anywhere Module sample code: class MyModule extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'My Module', 'version' => 100, 'summary' => 'ProcessWire is awesome', 'singular' => true, 'autoload' => false, ); } public function init() { // Do stuff after an instance of this module is created } public function myMethod() { return 'yeah baby!'; } } -
Hi, The template caching in ProcessWire does not interact with headers. It caches the output of a $page->render() call. This means that there is less server-side processing required. Should you want to modify the headers, you can use php: http://www.php.net/manual/de/function.header.php
-
You want to hook into this method: public function ___executeList() { return $this->renderList("limit=25, status<" . Page::statusMax); } It's defined in the superclass, ProcessPageType. As the renderList method itself is not hookable, you'd need to generate your own markup which is returned from executeList()
-
I never used twig but I think that the problem is that $page->template itself. So you could try: {% if page.template.name == "project" %}
-
There is a workaround, but it changes the value that is sent: $field->checkedValue = 'Yes'; Displays 'yes' as label