-
Posts
7,479 -
Joined
-
Last visited
-
Days Won
146
Everything posted by kongondo
-
They look quite different to me (the examples). addHookProperty does just that; adds a property. The property is available to the object you are attaching it to. You can't pass it any arguments to manipulate what it returns. addHookMethod/addHook allows you to add a method/function to an existing class or object. You can have the method you've 'created' accept arguments that inform the method's logic. Although the examples are similar, they are not identical. addHookProperty example. We cannot change/alter the output since this is a property (variable) unless we 'manually' assign it a new value // Accessing the property (from any instance) echo $page->lastModifiedStr; // outputs: "10 days ago" addHookMethod/addHook example. We can add as many arguments as we want to lastModified() since it is a method. In the example in the docs, the method accepts only one boolean argument. This allows us to alter what lastModified() returns. Hence, it offers more flexibility. echo $page->lastModified(true); // returns "10 minutes ago" echo $page->lastModified(false); // returns "2013-05-15 10:15:12" echo $page->lastModified(); // returns "2013-05-15 10:15:12" That's my understanding of it anyway...
-
Glad it worked .
-
Hi @Sebastian. Welcome to the forums. The real answer is that these forms were never intended for use in the frontend. Their purpose and design was for backend use only where trade-offs have had to be made between complying with standards versus delivering a usable and highly efficient UI, taking into account the underlying complexities that constitute the PW Admin. Using them in the frontend is just a bonus, but it comes at a 'cost'. You are probably better off using your own forms, or investing in Form Builder or similar.
-
OK, we are getting somewhere. In my previous testing I had one or two issues with comments but was never able to replicate the issue further. I suggest the following: Do a cleanup (but do no uninstall Blog) Make sure you have both Comments field and Schedule Pages modules installed Run Blog install wizard Enjoy your new Blog...hopefully
-
What is page with ID 1266. Is it a repeater page? Is it maybe in the trash? Either way, delete it manually and try again.
-
For now, maybe a manual upgrade is what you need, exactly what you are doing. Use this gist to cleanup, via the frontend as follows: Copy the code into a template file Login as superadmin In the frontend, visit a page that uses that template and follow the instructions Revert your template file to what it was before step #1 I suggest you also clear your file compilter. You can then install Blog. There are no changes in the latest version that would stop Blog from installing (compared to the older version). In fact, the newest version was one to make it compatible with PW 3.X. Let us know how it goes.
-
I'm not sure I follow. What do you mean you upgraded to the latest version of Blog. I assumed this was your first time installing Blog, hence had the latest version already? Did you follow the normal upgrade process or did you create a second blog folder under /site/modules/? If you have two Blog folders in there, that would lead to the the 'redeclare' error. Since you have the Fatal Error alongside the Compile Error, I don't think it is a compile issue, but a 'two-folders' issue. Perhaps you have a /site/modules/processblog/ and a /site/modules/blog/? If that's not the case, could you clear your cache (Refresh button when in Modules view). You might need to do that several times. I haven't tested Blog in 3.0.39, but did test in 3.0.42 so maybe that is not the issue. Please refresh the cache and try reinstalling. This time, install without enabling comments. Secondly, could you confirm that Blog components are installed, i.e. blog_xxx_fields and blog-xxx-templates.
-
Using $mypage->new page() - is there a way to upload a file?
kongondo replied to John W.'s topic in General Support
Use the method 'add' . $mypage = new Page(); // other code...for $mypage template, parent, title, etc... // find songs to add $songSelections = $pages->find('template=song-selections, limit=50'); // if we found songs if($songSelections->count()) { foreach ($songSelections as $song) { $mypage->song_artist_selections->add($song); } } $mypage->save(); References: http://processwire.com/api/ref/page-array/add/ (of main relevance in your case; see the examples on that page as well) http://processwire.com/api/ref/page-array/ http://processwire.com/api/arrays/page/ http://processwire.com/api/ref/wire-array/add/ (this and below, mainly FYI) http://processwire.com/api/ref/wire-array/ http://processwire.com/api/arrays/ -
Using $mypage->new page() - is there a way to upload a file?
kongondo replied to John W.'s topic in General Support
Aaah, it can work with a relative path then, nice . -
@MaryMatlow. Not a great start, eh? . I can't recall having seen such an error before in respect of Blog. What's your ProcessWire version? PHP version, etc? What does the PW error log say? With debug on, do you get any errors? You could also check errors with Tracy (a different module) if you have it installed.
-
@adrian, I know function names are case-insensitive, but maybe you could change this line from $destinationPage->$fieldName->add($item->getPathName()); to... $destinationPage->$fieldName->add($item->getPathname());// @note: lower 'n' in getPathname to match what's in the docs...Just me being silly.
-
Using $mypage->new page() - is there a way to upload a file?
kongondo replied to John W.'s topic in General Support
You will have to tell ProcessWire to add that file to the file field and supply an absolute path (I don't think a relative path will work). See @adrian's example here if you want to add multiple files or my example here if adding single file. In my example, the file could also be in a sub-directory and the code will still work (i.e., it's recursive). Here's some code (it's not recursive and it's not namespaced). Note that you will have to first create the page and save, then add the file(s) and save again. Also note this will add all songs in the /temp/ folder to the one page. If you want different songs in different pages we would have to change the logic. // your previous (create page) code here $path = $config->paths->templates . 'temp'; $dir = new DirectoryIterator($path); foreach($dir as $songFile) { if($songFile->isDir() || $songFile->isDot()) continue;// skip system files and directories/folders $mypage->song_mp3_file->add($songFile->getPathname()); unlink($songFile->getPathname());// if you want to delete the mp3 files in the temporary folder } // save the page again $mypage->save('song_mp3_file'); //rmdir($dir);// if you wish to remove the temp directory Untested, but should work -
Hi @videokid, Thanks for your interest in the module. Dynamic Selects only works with existing values. So, no, there's no way to input new values. Given that values can be anything from a list of users, to fields, to page titles, file or image names, such a feature will be quite the task to pull off. What did you have in mind?
- 96 replies
-
- chained-selects
- dropdowns
-
(and 2 more)
Tagged with:
-
Hi @Rudy. I think I have seen that error before in PW 3.X. I am not sure whether it is related to the PW version or if it is related to memory maxing out. My guess is that your file is an image file? If so, then it is probably a large image and PW chokes on the thumb creation...due to memory issues. Is the file added OK to your Media Manager library, i.e. it has a proper title, etc? Were you uploading the single file or multiple files? Please clarify these issues so that I can investigate further, thanks.
-
Have a differeent title on a field across multiple templates?
kongondo replied to OpenBayou's topic in Getting Started
http://processwire.com/api/hooks/ -
Hey @microcipcip. Did you manage to resolve this? I don't have an answer for you though - I have never used Vuejs. I searched for a simple 'how to use Vuejs' example but could not find one that did not require to install stuff via npm (or do stuff with gulp, or grunt or bower or similar; I don't use these tools [fortunately or unfortunately] - who comes up with such names anyway? ). Anyway, would like to help test but don't have time to learn to use npm and similar .
-
Hi @Nukro, Thanks for reporting this. I haven't really tested MM in a ML-setup but will now do so.
-
Field for selecting form to embed (list all forms)
kongondo replied to heldercervantes's topic in Getting Started
@heldercervantes...if you haven't done so already, you want to request @ryan to add you to FB's VIP support forum (assuming your purchase's support is still active). -
Repeaters page creation loop until server crash
kongondo replied to Francesco Bortolussi's topic in General Support
@Francesco Bortolussi This is not an answer to your question. I am not fully certain that what you have reported is a security issue. For now, I have moved the thread to the 'General Support' area. It would be good if you could file a bug report and provide other details as well (PW version, environment, etc). Thanks. -
It will soon click and it is code you can reuse . Btw, I added a note on concatenation in my code above.
-
I am assuming by post you are referring to the $child? What is not clear is whether you want the title of the parent of the current page or the title of the parent of $child. Anyway, here's some code. // will give you the title of the parent of the current page // @note: if on 'home' page, will return nothing since 'home' does not have a parent $page->parent->title; // will give you title of the parent of $child // @note: since you are in loop, this will be repeated for each $child // but you already know the parent. It is 'recommendations'...so, @see alternative code below $child->parent->title; /** alternative code **/ // get the parent page $r = $pages->get('/path/to/recommendations/'); $out = '';// empty variable that we will populate with final output if($r && $r->id && $r->numChildren) {// checks if we found a valid page and it has children $out .= $r->title;// @note: about the .= read up on PHP concatenation (we are adding to the previous value we found here, rather than using multiple echos) foreach ($r->children as $child) { $out .= $child->title; $out .= '<img src="' . $child->Image->first()->size(200,0)->url '">'; } } // output echo $out; Also note, ideally, you want to name your fields all lowercase, i.e. 'image' rather than 'Image'.
-
Welcome to the forums and ProcessWire @Emile. You probably know this already, but since you are new, I just want to confirm that you edited /site/config.php and NOT /wire/config.php ? .
- 3 replies
-
- 1
-
- cache
- config.php
-
(and 1 more)
Tagged with:
-
You could also shorten this... $config->urls->admin."page/edit/?id=".$page->id ...to this (available since PW 2.5 I think) $page->editURL, Welcome to the forums
-
Thanks for sharing this @ryan. It throws up some very interesting statistics. They seem to be very up to date, assuming of course that their research methodology was sound. I have no reason to doubt them though . Some interesting stuff on this page as well.
-
The code in your first post, is that in a template file or elsewhere? Not necessarily the cause of the error, but am wondering whether you are in a function context or not. Edit: These may be of relevance to you... https://processwire.com/talk/topic/12272-308-call-to-undefined-function-because-of-compiled-files/ https://processwire.com/talk/topic/12214-templates-namespace-and-modules-problem/ https://processwire.com/talk/topic/11815-undefined-variable-pw-3-wirerenderfile-use-compiled-file/ https://processwire.com/talk/topic/13500-variables-scope-in-included-files/ https://processwire.com/blog/posts/processwire-3.0-alpha-2-and-2.6.22-rc1/#compiled-template-files