Jump to content

kongondo

PW-Moderators
  • Posts

    7,529
  • Joined

  • Last visited

  • Days Won

    160

Everything posted by kongondo

  1. Maybe because of this? Repeaters are admin pages. Guests do not have view access to repeater pages (page where the field exists), hence, even though guest had view permission, they still couldn't view the field since it lives in a restricted area (repeater). In other words, their view permission was not 'applicable'.
  2. Where is Schule and Meht Erfahren coming from? Is Schule coming from $page->title? Where is the content Musik erlerenen coming from? From $page->body? Or some other field? I am asking since there could be one or more permission restrictions in place. Possible issues: You have in condition in your template file that is restricting the output of the content. It could even be a hardcoded value of a page ID that doesn't existing in your import site. I.e., in the export site, SOME_PAGE might have the ID 1234 which when you import in your local/other site is saved as SOME_PAGE with ID 1255. You have a field-level view restriction. Especially if only the content of one field is not showing, I would focus on this. You have template-level view restriction. This means that SOME_PAGE utilises 'some-template' which has view restrictions. Is this happening on all the pages? Is it happening on pages that use different templates?
  3. Hi @Allan, Welcome to ProcessWire and the forums. moderator note: I merged your two posts. I also added code blocks around your HTML code for better readability. In addition, I wrapped it inside a spoiler because it is a long piece of code. This also helps with readability (and scrolling).
  4. Depending on what you are doing with the pages, you could do a $pages->findRaw($selector,$fields); instead.
  5. 99.9% of the time I use option #1 as detailed here, i.e. multiple sites with multiple databases AND ONE wire folder. Each site has its own database and /site/ directory (templates, modules, etc.). If I need a site (project) to be stand alone, I create the site separately with its own wire folder.
  6. Thunder Client — lightweight alternative to Postman Thunder Client is a lightweight Rest API Client Extension for Visual Studio Code (it is not open-source). Launch article Quick demo
  7. Yes. From your description, it sounds like you want you page to display differently depending on the view port (?) and/or device (?) it is being viewed on. In that case, you can accomplish that using CSS (apologies; I am not sure about your coding capabilities, so please, ignore me if you knew this already :-)) and JavaScript (most likely, optional). On the other hand, if what you actually meant is you want ProcessWire to output different gallery page views depending on some condition, then the answer is a tentative yes. We'd need to know what that condition is first. Maybe you could explain your use case? My feeling though is that you are referring to client-side conditions as opposed to server-side.
  8. That's quite an old version of ProcessWire. ready.php and the likes were introduced in ProcessWire 2.6.7, so you cannot use ready.php in your version. You can still use the API to change your password. You will need to add the code to a template file. Pick one template file from your /site/templates folder, edit it, and add the following code. The steps are: Pick a template file. Open it for editing. Depending on your server, you might have to download it to edit it locally the upload the edited version. Add the code below. The code needs to be added within php code blocks within that template file. Do not delete your templates existing code. Visit a page on your website (frontend) that uses that template file (e.g. an about page that uses a template called basic-page, etc). Your password (and optionally user name) will be changed. Edit the template file in #1 and #2 above. Remove the password change code. Reupload the edited template file if it was edited locally. Go to your admin URL and login with your new password (and new name if you changed it as well). PHP code <?php namespace ProcessWire; #### DON'T ADD ABOVE TO YOUR TEMPLATE FILE. IT IS JUST FOR SYNTAX HIGHLIGHTING HERE #### ################# COPY CODE STARTS HERE ################# // get the default ProcessWire admin superuser $admin = $users->get(41); // turn output formatting off $admin->of(false); // change the password $admin->pass = "YOUR_VERY_STRONG_PASSWORD_HERE"; // change the user name (optional: comment out code if you know and want to use the existing user name) $admin->name = "YOUR_USER_NAME_HERE"; // SAVE YOUR CHANGES $admin->save(); ################# COPY CODE END HERE #################
  9. Below is one way to detect if the page is new, in which case add our script. The disadvantage of this is that the whole file is only included under certain conditions as opposed to a just a function inside the file being called under certain conditions. This means the admin.js file will only be used for focusing the list_price field. There are other ways around this. Hopefully others will chime in with better solutions/ideas. Change the ready.php code I suggested above to this one: <?php namespace ProcessWire; $this->addHookBefore('ProcessPageEdit::buildForm', function (HookEvent $event) { $page = $event->object->getPage(); // new pages GET a 'new' query string/parameter, i.e. &new=1 // we check that $new = (int) $this->wire('input')->get('new'); if ($new && $page->template == 'book_sales') { $config = $this->wire->config; $url = $config->urls->templates; $config->scripts->add($url . "scripts/admin/admin.js"); } }); There's probably other more elegant ways to detect if a page is new but I cannot remember any of the top of my head at the moment.
  10. OK. STEP #1 Create a file, e.g admin.js and save it to your preferred location. In this example, we have saved it at site/templates/scripts/admin/admin.js STEP #2 Add either of the below JS code in admin.js (you don't need both; choose one or the other). jQuery version: $(document).ready(function () { // #wrap_Inputfield_list_price is the ID ProcessWire will assign to your list_price field's wrapper (an li element). // you can confirm this by examining the markup around your 'list_price' input in dev tools. // Inputfields is a utility files that ships with ProcessWire. // more details: inputfields.js - JS specific to behavior of ProcessWire Inputfield forms. Inputfields.focus("#wrap_Inputfield_list_price") }) Plain JavaScript version: const InputfieldAdminScripts = { focusAnInputfield: function (inputfield_id) { const inputfieldToFocus = document.getElementById(inputfield_id) // if we found the element,focus it if (inputfieldToFocus) { inputfieldToFocus.focus() } }, } // DOM ready document.addEventListener("DOMContentLoaded", function () { InputfieldAdminScripts.focusAnInputfield("Inputfield_list_price") // this will also work here. you can use it instead of the above // Inputfields.focus("#wrap_Inputfield_list_price") }) STEP #3 Inside ready.php, add this code to load admin.js. You can modify this to only load under certain conditions if you wish. <?php namespace ProcessWire; $this->addHookBefore('AdminTheme::getExtraMarkup', function (HookEvent $event) { $config = $this->wire->config; $url = $config->urls->templates; $config->scripts->add($url . "scripts/admin/admin.js"); }); Please note that in Chrome (and maybe FF as well), if you have your dev tools opened and the cursor currently focused on it, the inputfield might not seem to be focused, but it actually is. ?
  11. What field is this? Title field? There's two steps to this: Add your custom JS to the admin Add your code to the custom JS file. For #1, there's many different ways to do this. Have a look at these two threads, for instance: For #2, it depends on the input you want to target. The easiest way is to target it by ID. Or grab it using ProcessWire Inputfields API and focus it. If you can be a bit more specific about the field, we can provide ready-to-go code (some of which have been posted here already, actually).
  12. No, you cannot focus an input using PHP. Autofocus is usually achieved using JavaScript. E.g. // get input you want to focus // in this case we know its ID, so we are grabbing it that way // we focus it using the focus() method // you could throw this into a function if you wanted document.getElementById("your_input_id").focus(); Alternatively, you can do this in the HTML, i.e. the PHP code that is outputting the HTML by using the autofocus attribute. <label for="my_input">Book Title:</label> <!-- the browser will focus this input when the page loads --> <input type="text" id="my_input" name="my_input" autofocus> <label for="my_input">First name:</label> <!-- the browser will focus this input when the page loads --> <input type="text" id="my_input" name="my_input" autofocus> References https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus https://www.w3schools.com/tags/att_input_autofocus.asp Read about the accessibility considerations if you will be using autofocus.
  13. Here you have several options. Server-side, my favourite is WireCache ($cache variable). I am assuming you don't have ProCache. That would make your pages load even faster. You could also cache client-side on the browser.
  14. Depends on what 'lots of pages' amount to. Assuming you know the IDs beforehand, one way you could do it. <?php namespace ProcessWire; $ids = [1100,1101,1102,1103]; $selector = implode("|",$ids); $fields = ['id','title'];// depends on the fields you want; 'id' can also be left out in which case you get it as the key of each item $items = $pages->findRaw($selector,$fields);// Array // or if you need the pages // $items = $pages->find("id={$ids}");// PageArray Another way would be to cache the menu, if it is not dynamic.. Just a few thoughts.
  15. Hi @ryan, does this have an impact on init.php and ready.php? For instance, will init.php still not be aware of the current page? Can $pages->request()->getPage() inside a template file be a replacement for ready.php? Thanks for the awesome updates!
  16. Or do this... Or one of these... (includes the extension @adrian mentioned above)...
  17. kongondo

    other CMSs

    Hmmm. You've just given me an idea right there ?.
  18. kongondo

    other CMSs

    @AndZyk, I don't think this is entirely accurate. Maybe things have changed since I last read the thread but below is the quote from @ryan with respect to his thoughts on a layout / page builder: https://processwire.com/talk/topic/25129-weekly-update-–-12-february-2021/ So, it is not a matter of lack of interest but more about 'lack of expertise', albeit with willingness to support it on the PHP (ProcessWire) side ?. By the way, I could have offered to take lead on this but until a certain module is released (getting very close now! ?), I don't have much time for anything else ?.
  19. @JacobParks. I have moved your 'non-serious' thread to the appropriate forum for it. I must say that your first post seems like a primer for spam. I hope I am wrong, in which case, please accept my apologies. We do take spam very seriously.
  20. Wow. I didn't even know this module existed ?. I have just had a quick look so cannot comment much. You should be able to create your own version of the module which ProcessWire will subsequently detect and ask which one to load (I think this applies to Process Modules too - anyone?). Maybe a hook would work too, but am not sure. Looks like the links are created in JavaScript, so, you would need to consider that too. Maybe your solution could be all at the JavaScript level, although in that case you would need access to the value for your data-attributes. Sorry I am not of much help. Just a few starter thoughts ?.
  21. Not an answer to your question, sorry. Just wondering what is this link edition? Thank.
  22. Is there a particular reason why you need to use config->js() for this? In a template file, the following should work just fine: <?php namespace ProcessWire; $mydata = ['foo' => 'bar', 'bar' => 123]; $script = "<script>const mySettings = " . json_encode($mydata) . ';</script>'; echo $script; // OR: $content.= $script; if using delayed output with automatic inclusion of _main.php, for example. In the console...
  23. Typically two choices if you want a custom 'view' in the admin. If custom view per page, i.e. as some sort of field / inputfield: have a look at the growing number of runtime markup fields in the module's directory A dedicated admin page view: You will need to create a custom module. More specifically, regarding data, and lots of it or spreadsheet-like data, have a look at @bernhard's modules and work in the forum. Looks like he has done extensive work in this respect. I am in a bit of a rush so cannot be more concrete. Hope this helps you get started.
  24. Hi @CarlAllen, First, congratulations on your upcoming marriage. Wishing you every success in that and your move to the Netherlands. The board you have posted in is meant for job postings, i.e. people looking to hire posting about available jobs and their requirements. As such, I will have to move your post to a different forum for general talk. In addition, I would suggest you post your interest and/or resume in dedicated job portals as it seems your requirements are not necessarily specific to ProcessWire. In any case, I wish you the very best of luck for the future.
  25. Yes I noticed this as well, especially with respect to Python. I almost glossed over it thinking it was a Python-only tech ?.
×
×
  • Create New...