Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by kaz

  1. @cstevensjr I have the same question. I can't find it under General Support or Form Builder Support. Where the post was moved to?
  2. kaz

    if query

    @zoeck interesting, I didn't know that in an array the search is different
  3. kaz

    if query

    Funny, how an if statement behaves. I wanna check whether a field has content. So I asked about the field: if ($article->gallery_images) If yes, I only want to output only the first image as a preview in an summary page, that's why I only retrieve these first image: if ($article->gallery_images) { echo " <div class='' uk-grid> <div class='uk-width-1-5@m uk-width-1-1@s'> <img src='{$article->gallery_images->first->url}' alt='{$article->gallery_images->first->description}'> </div> <div class='uk-width-4-5@m uk-width-1-1@s'> $content </div> </div>"; } else { <div class='uk-width-1-1'> $content </div>"; } The query does not work, even if no data is uploaded to the gallery_images field, is else not displayed. Now the funny part: When I add ->first to the if query, else is displayed, the query will work: if ($article->gallery_images->first) { echo " <div class='' uk-grid> <div class='uk-width-1-5@m uk-width-1-1@s'> <img src='{$article->gallery_images->first->url}' alt='{$article->gallery_images->first->description}'> </div> <div class='uk-width-4-5@m uk-width-1-1@s'> $content </div> </div>"; } else { <div class='uk-width-1-1'> $content </div>"; } I have hardly any PHP experience, so perhaps I don't understand why this is the case, but: it surprised me in terms of logic.
  4. @ngrmm works great, thanks for the hint with a variable!
  5. A client would like to have a checkbox or similar for an image field in order to apply a style. echo " <img class='{$page->check}' src='{$page->image->url}'>"; I have thought about creating a checkbox, but it's not so easy because the class must given out in an echo. How to pass a class, a style in an echo?
  6. @gmclelland I have it in the /views folder, not /fields, because in PageTable I have to select a template. PageTable does not allow to select a folder, so my templates are in the /views folder 😉 I would prefer to have the widget templates in an own folder, but it's not possible with PageTable. This is the code of my bodysection file (PageTable Field): <?php namespace ProcessWire; // Loop through each element in the PageTable field foreach($bodysection as $section) { // Get the template of the page in the PageTable field $template = $section->template->name; // Depending on template, render the content switch($template) { case 'section-content': // "section-content" template rendered here echo $section->render(); break; case 'section-gallery': // "section-gallery" template rendered here echo $section->render(); break; case 'section-…': // and so on break; } } Only the Page IDs are received in frontend, at least the IDs are correct, yeah: 1122|1124
  7. Is there perhaps an official documentation for PageTable? I can't find anything in the forum posts explaining how to render PageTable templates? I placed two templates in the /views folder and inserted them in the Page Table field. The editor can now add the elements of the templates. The section-content is saved on a hidden page which I created separately in the admin area. My nameofpagetablefield does not transfer any data. echo $page->render('nameofpagetablefield'); There is no error, I don't understand where to look? But how do I use foreach to render different items / templates?
  8. @artfulrobot Thank you for these amazing screenshots, it's easy to understand. I'm sorry, but I have the solution from @teppo with a "ProFields: Page Table" field.
  9. I have done it this way, but I think the link is missing. I have a page table field section_blocks. As described, I did not select an >Details >Template. In the /fields folder I have a section_blocks.php <?= $item->render(__DIR__ . '/section-blocks/' . $item->template . '.php') ?> I render it in my basic template: <?= $page->render('section_blocks') ?> For this I have two two simple templates: /site/templates/fields/section-blocks/block_content.php /site/templates/fields/section-blocks/block_gallery.php When I open the page in the editor, I get the following error message: Please select a template before using this field. Please specify one or more columns in the settings before using this field. What I can't find in the configuration of the section_blocks field: Configure your Page Table field to save new items below aforementioned root path, and make sure that you only enable templates that you've created for this purpose. So the connection is missing, and I wonder, how do I set up the connection? What have I overlooked?
  10. I do different content sections with Repeater Matrix. Since there are more and more sections, I would like to choose another solution. I don't have any experience with Page Table, but based on what I've read, it seems like a possible alternative? My repeater matrix script is a foreach, so that the user can extend it as needed. <?php foreach($page->sections as $item) { if($item->type == 'content') { echo " <h1>$item->title</h1> $item->content "; } if($item->type == 'links') { echo " … "; } and so on } I can add the items of the above script as single templates for Page Table, and add them in a Page Table field (Details). In my base template I call the page table field, e.g. echo $page->render('sections'); On my first try, a child page was added, which I don't really want. The code from the template which I had added in the field (details) was not taken over either. In short, I need help. Can perhaps someone give me a little HOWTO on how to do this correctly? Maybe Page Table isn't suitable at all?
  11. @Nicolas great, it works perfectly!
  12. I have need some scripts only in two pages. In one page I use an if query with the ID if ($page->id == 1042 ): Is a query able to use multiple IDs? 1042 | 1043 and 1042 && 1043 will not work
  13. the error is still displayed under the current version (3.0.226). I was not able to fix it. I think it's part of another component, I can't explain it otherwise.
  14. It was the cache. I increased the cache up to 128 with a .user.ini file memory_limit=128M; after that, the page worked fine. Thanks for trying to help.
  15. Well, then it is not due to the memory limit that the page is not displayed after installation. After installation I can login to the backend, everything works as usual. I do the installation with the ProcessExportProfile module, I had never problems so far. Now the frontend starts AFTER the installation WITH THE installation, like a loop. But all installation files were deleted during the installation as selected (checkbox default). Therefore I always see: The index file: if(!defined("PROCESSWIRE")) define("PROCESSWIRE", 300); // index version $rootPath = __DIR__; if(DIRECTORY_SEPARATOR != '/') $rootPath = str_replace(DIRECTORY_SEPARATOR, '/', $rootPath); $composerAutoloader = $rootPath . '/vendor/autoload.php'; // composer autoloader if(file_exists($composerAutoloader)) require_once($composerAutoloader); if(!class_exists("ProcessWire\\ProcessWire", false)) require_once("$rootPath/wire/core/ProcessWire.php"); $config = ProcessWire::buildConfig($rootPath); if(!$config->dbName) { // If ProcessWire is not installed, go to the installer if(is_file("./install.php") && strtolower($_SERVER['REQUEST_URI']) == strtolower($config->urls->root)) { require("./install.php"); exit(0); } else { header("HTTP/1.1 404 Page Not Found"); echo "404 page not found (no site configuration or install.php available)"; exit(0); } } $process = null; $wire = null; try { // Bootstrap ProcessWire's core and make the API available with $wire $wire = new ProcessWire($config); $process = $wire->modules->get('ProcessPageView'); /** @var ProcessPageView $process */ $wire->wire('process', $process); echo $process->execute($config->internal); $config->internal ? $process->finished() : extract($wire->wire('all')->getArray()); } catch(\Exception $e) { // Formulate error message and send to the error handler if($process) $process->failed($e); $wire ? $wire->trackException($e) : $config->trackException($e); $errorMessage = "Exception: " . $e->getMessage() . " (in " . $e->getFile() . " line " . $e->getLine() . ")"; if($config->debug || ($wire && $wire->user && $wire->user->isSuperuser())) $errorMessage .= "\n\n" . $e->getTraceAsString(); trigger_error($errorMessage, E_USER_ERROR); } as already written, install.php was deleted at the end of the installation. I wonder where the installer now came from?
  16. I installed a new site. The installation was without problems except for one message: I have continued the installation (ProcessWire 3.0.210) up to: Finished installing site profile, and log into the backend as usual. When I open the frontend, I have again the installer: ProcessWire 3.x Installer ... The install.php is deleted, I checked it via FTP. What is going wrong here. I have already redone the installation twice. Why is the "ProcessWire 3.x Installer" called again? When I start "get started", I land on a part of my frontend. crazy, or?
  17. I have a template with settings. The data are created in FieldsetGroup's. When I select a FieldsetGroup the cursor changes to a hand and I may open the group. I had to remove a group from the template. I removed the group via the icon, and confirmed the warnings. On the page which uses the template everything looks right. But unfortunately the other groups can't be opened now. I click, nothing happens. So I took the group back into the template (although I don't need the parts), but unfortunately the FieldsetGroup's remain dead. What could be the reason for this?
  18. This module is from Ryan, you don't have to worry about it.
  19. Template development is very slow under macOS, MAMP Pro. Every click in the backend takes a lot of time. Is it normal?
  20. I have found why it does not work. It only works with the ProFields module Functional Fields.
  21. I have a website with a landing page. The layout of the content pages has $config->prependTemplateFile = 'views/partials/_prepend.php'; $config->appendTemplateFile = 'views/partials/_append.php'; The layout of the landing page template is completely different, with a different header and footer structure. Because it's only one template / one page, I don't need an entry in the config. I'm figuring out how to solve this? The entry in the config assigns the prepend and append file to all pages? It would be great if the template landing.php does not have a prepend and append file assigned to it. Is that feasible?
  22. You may save an project with the module ProcessExportProfile for a new installation. Open Export Site Profile under Administration. Create a new profile in the input mask. Copy this /site folder (site-yourprojectname) into the installation folder before a new installation, select your site profile, that's it. Everything is included, only own files like ready.php … are not included, have to be transferred manually.
  23. I have installed Multi-language, activated the (Multi-Language) fields, added an additional language, and of course an language switcher. All content works fine, all fields are translated. But translatable strings do not work. Here's an example: <?php echo __("Kontakt");?> or <?php echo "<h6>" . $this->_('Kontakt') . "</h6>";?> Under Languages I find the PHP file with the entry "Kontakt", I translate the text "Contact". But the translation is not visible in the frontend. What did I forget?
  24. @joshua I have read the documentation. Sorry, no banner is displayed for me after I confirmed it once days ago. Unfortunately, in none of three browsers (macOS). At Klaro there is a possibility to keep the dialog visible via a code https://example.com#klaro-testing. How do I get to see it on PrivacyWire? Functionality: What do I do after installation, how do I add these following Processwire modules / functions: OpenStreetMap (FieldtypeLeafletMapMarker, InputfieldLeafletMapMarker, MarkupLeafletMap) Video embed for YouTube (and Vimeo) (TextformatterVideoEmbed) In the documentation I read: "When you want to load specific scripts ( like Google Analytics, Google Maps, ...) only after the user's content … add 'data-category="statistics"'" The module for OpenStreetMap is integrated like this: <?php $map = wire('modules')->get('MarkupLeafletMap'); ?> <?php echo $map->getLeafletMapHeaderLines(); ?> I can't add anything, if I haven't overseen something? In the TextformatterVideoEmbed options I have this GDPR option: [ ] GDPR: Use the no-cookie / do-not-track version of video URLs but no possibility to extend the module code as shown in the documentation. I am probably completely wrong with my assumption that this is the way to connect things to PrivacyWire? Sorry if I oversaw something, the more I read the more it confuses me. Maybe it will work sometime, to enable installed things like TextformatterVideoEmbed in PrivacyWire, and done 🙂 Thanks for the module, I'm just struggling a bit with the functionality.
  • Create New...