-
Posts
10,912 -
Joined
-
Last visited
-
Days Won
349
Everything posted by adrian
-
Ok great - I actually made that change to the module already - I figured that it made sense regardless of whether it worked for you or not - still not sure why it was working as is for me - I am still getting the hang of this namespace stuff Is it possible that your template doesn't have any defined variables? That wouldn't be uncommon in a simple template where you are just outputting PW fields. Try defining a test variable somewhere in the template file, eg. $test = "this is my test variable"; and let me know if it starts showing up after that. Btw - thanks for continuing to help debug this - really appreciated
-
So the line added to the end of my compiled template files currently looks like: if(class_exists('TracyDebugger')) { TracyDebugger::$templateVars = TracyDebugger::templateVars(get_defined_vars(), \ProcessWire\wire('page')); } Does that match what you are currently seeing? What if you manually add \ProcessWire\ in front of each TracyDebugerr, like this - just do it for one of the compiled template files and load a page with that template - this is just a test for me at the moment to help debug. if(class_exists('\ProcessWire\TracyDebugger')) { \ProcessWire\TracyDebugger::$templateVars = \ProcessWire\TracyDebugger::templateVars(get_defined_vars(), \ProcessWire\wire('page')); } I feel like I am going off on a tangent here, but what happens if you also add false to that check, eg: if(class_exists('\ProcessWire\TracyDebugger', false)) { \ProcessWire\TracyDebugger::$templateVars = \ProcessWire\TracyDebugger::templateVars(get_defined_vars(), \ProcessWire\wire('page')); }
-
I haven't tried, but I don't think there is an "add" method for the options fieldtype. Did you read here: https://processwire.com/api/modules/select-options-fieldtype/#manipulating-options-on-a-page-from-the-api Also, shouldn't your: $field->months = $array; be outside the "for" loop?
-
You'll need to grab the image using wireUpload (or some other method if you prefer), then rename, then you can "add" to the image field. Take a look at this solution by Sevarf2: https://processwire.com/talk/topic/5490-hook-for-wireupload-filename-images/?p=53997 The reason is the filename not ending in an image extension - PW's sanitizer won't allow it through when directly adding. Hope that helps.
- 10 replies
-
- api
- page creation
-
(and 2 more)
Tagged with:
-
You need to empty .../site/assets/cache/FileCompiler/site/templates, not .../site/assets/cache/FileCompiler/site/modules Please tell me that works
-
any workflow improvment on adding child pages repeatly
adrian replied to adrianmak's topic in General Support
https://processwire.com/talk/topic/6102-batch-child-editor/ Try out the Add mode - just enter a page name for each row in the textarea and you're done!- 1 reply
-
- 1
-
@Ipa - did you clear your FileCompiler templates cache after installing the new version? - this is essential to ensure the new version of the code is added into the templates when they are compiled. Sorry, I should have made it more obvious that for this feature to work, you need to clear your compiled templates cache as it needs to add a line to the bottom of the compiled template. Once you do this once, it will work for future updates to your templates.
-
Awesome - thanks for letting me know. I did just make another change though in an attempt to fix the problem @Ipa is still having with the Variables panel. Hopefully this might work and hopefully I haven't broken anything for anyone else
-
Yeah, it is that feature which is responsible for adding that line to the bottom of the compiled templates - I just don't yet know why you are still getting the error and @tpr isn't and I have never seen it What version of PW and PHP are you running? Glad it's working now - thanks for letting me know. What do you mean about it being related to your browser?
-
@BernhardB - please try the latest version for me.
-
Actually I am seeing @BernhardB's issue when running 2.7.2 - I'll hopefully have a fix soon.
-
@BernhardB - are you using the latest version? Also, what version of PHP are you using - I wonder if there might be something connected with that? @Ipa - can you please try emptying the site/assets/cache/FileCompiler/site/templates folder and see if it starts working after that?
-
What happens if you prepend a slash? $dotenv = new \Dotenv\Dotenv(__DIR__);
-
$player->of(false); foreach($player->equipment as $equipment){ $u->equipment->remove($equipment); } $u->save("equipment"); EDIT: Ignore this and go with BitPoet's solution. I was just confirming that removeAll() worked, but he beat me to it
-
@Ipa and @tpr - can you please try the latest version and see if that error is now gone? Speaking of the latest version, it includes a few new features. The ability to force superusers to always be in DEVELOPMENT mode, even on a live site. The ability to restrict non-superusers by their IP address - this is very useful if you need to debug a live site for a guest (or non-superuser role) and want the debugger bar and other features normally restricted to development mode. You can set the mode to DEVELOPMENT, give the user the "tracey-debugger" permission, and then restrict to your current IP address. The Users panel provides details of IP Address restriction so you can always easily check if you're safe.
-
Does it stick around? or is it gone once you reload the page or something? Can you post the last line of one of your template files that is producing the error? Nevermind - sorry I see that @Ipa has already posted his.
-
Do you mean that it needs to stay as is and separate from the newly proposed multiple checkbox fields that lists checkboxes for all the panels, or do you think that it actually needs to be a separate checkbox field for frontend and another separate one for backend? Sorry, i am not seeing why they need to be separate ones, but it's early here, so maybe just not awake? Nevermind, you just mean separate options within the one checkbox field, together with all the panels. Although I actually think it might still make sense to leave this as a separate field, because it is not related to panels - it's the entire Debug Bar. Hoped that sounds ok to you. I guess I could also set it up so that you could choose which panels appear on the frontend and which ones appear on the backend - make them separately configurable, although not sure if that would really be that useful?
-
Hi @Ipa, Sorry about this. To populate the new "Variables" panel I am adding a line to the bottom of the compiled template files, but it includes a check to see if the class exists so I am not sure why you are getting that. Could you please post what that last line looks like for you?
-
Very good point - are you meaning one field of multiple checkboxes, or a collapsible fieldset of with all the options as they currently are? I think the former would probably be quite nice, but it might be a pain for you guys when updating to a new version that has this because your current settings would be lost. I guess I could have some logic to convert the old separate checkboxes to the new multiple checkbox field, or maybe it doesn't really matter that much if you have to set them again? I'll have a think.
-
From the default PW htaccess file: # ----------------------------------------------------------------------------------------------- # If you only want to allow HTTPS, uncomment the RewriteCond and RewriteRule lines below. # ----------------------------------------------------------------------------------------------- # RewriteCond %{HTTPS} off # RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
-
Table URL Field Type: Add a Destination URL on Output?
adrian replied to Tiffany Janisch's topic in General Support
Hi Tiffany - is this what you are looking for? foreach($page->tbl_CompanyURLs as $c_url) { if($c_url->url_company) echo "<a href='{$c_url->url_company}'>$c_url->url_company</a><br />"; if($c_url->url_updated) echo "<a href='{$c_url->url_updated}'>$c_url->url_updated</a><br />"; } -
Page added to page field does not appear to be saved
adrian replied to rlwsota's topic in API & Templates
No problem, I thought I should add that you can also do: $user->setAndSave('favs', $page_id); Simple as that! It's a relatively new method and I still forget about it myself. Read more about it here: https://processwire.com/blog/posts/processwire-2.6.9-core-updates-and-new-procache-version/#new-page-gt-setandsave-method -
Page added to page field does not appear to be saved
adrian replied to rlwsota's topic in API & Templates
Yep, so this is what you need: $user->of(false); $user->favs->add($page_id); $user->save("favs"); This of course assumes you are editing the currently logged in user. If not, then something like this: $u = $users->get($user_id); $u->of(false); $u->favs->add($page_id); $u->save("favs"); -
Page added to page field does not appear to be saved
adrian replied to rlwsota's topic in API & Templates
Are you trying to add a new page to the list of available favs, or to select a page from favs (defined by $page_id) for the current user's favs field? -
Page added to page field does not appear to be saved
adrian replied to rlwsota's topic in API & Templates
Make sure you have debug mode on (or TracyDebugger installed) and let us know if there are any errors. I think it might be as simple as needing to add: $p->of(false); before you add the page.