Jump to content

kaz

Members
  • Posts

    269
  • Joined

  • Last visited

Everything posted by kaz

  1. @ryan I usually use the project name as the password for the database during the local installation. $config->dbHost = 'localhost'; $config->dbName = 'project'; $config->dbUser = 'project'; $config->dbPass = 'project'; $config->dbPort = '3306'; $config->dbEngine = 'InnoDB'; I may have done it differently for this project; I have the password written down in my notes, but it doesn't work. Because the database is set up in MAMP, I contacted appsolute GmbH for help. I hope that there is a way to renew the password. Thanks for the help!
  2. @BitPoet I have the superuser password, I think I probably remember the database password wrong. I will contact MAMP, there will surely be a way to reset the database password?
  3. @ryan I have entered the $config dates. salt entries I've taken over from the live version, the online version works fine. The error message remains. I guess I will try to renew the database password in MAMP, I hope that's possible? The other data should fit if salt is the same as the online version.
  4. I accidentally overwrote the local config.php with the online version via Transmit. Clearly, the data does not fit locally. I have already updated the correct user, database name and password in these local config, but it does not work. Access is denied: Dangit… Error: Exception: SQLSTATE[HY000] [1045] Access denied for user 'username'@'localhost' (using password: YES) (in wire/core/WireDatabasePDO.php line 505) I don't know what to do now? What, for example, is userAuthSalt and tableSalt? Of course I don't have these data. Is it possible to renew the access data in the local database with PhpMyAdmin? If there's no way to renew the config, how do I keep the project alive? I have the data, the database, only the config is gone.
  5. @bernhard Thanks that works great. And also thanks for the training. I am quietly learning from a book by Christian Wenz and Tobias Hauser, but some parts only become clear when I use :)
  6. I have an address in the global settings which is displayed on all pages in the sidebar. <?php if ($global->businesshours): ?> <?php include('businesshours.php'); ?> <?php endif; ?> The client asked me to hide the address on only one page, id 1127. I can have an element displayed on a single site via a query, if ($page->id == 1042 ), but can I also exclude a page in an include?
  7. @TomPich If it can't be changed, it should be fine.
  8. I need to implement double quotation marks with a line break in an if query. my current code: <script type='application/ld+json'> { '@context': 'https://schema.org', 'sameAs' : [ <?php if ($global->facebook): ?><?= $global->facebook; ?>,<?php endif; ?> <?php if ($global->instagram): ?><?= $global->instagram; ?>,<?php endif; ?> <?php if ($global->linkedin): ?><?= $global->linkedin; ?>,<?php endif; ?> and so on ] } </script> and this is how it should look, if there is an entry: <script type="application/ld+json"> { "sameAs" : [ "https://www.facebook.com/company", "https://www.instagram.com/company", "https://www.linkedin.com/company", and so on ] } </script> <?php if ($global->facebook): ?>"<?= $global->facebook; ?>",\n<?php endif; ?> <?php if ($global->google): ?>"<?= $global->google; ?>",<br /><?php endif; ?> The double quotes work because I used single quotes for the the rest. The line break (\n or br) is not generated in source code. The code is output as text, maybe because it hangs in the echo? The source code looks as follows: "https://www.facebook.com/company",<br /> "https://www.instagram.com/company",\n https://www. How do I set line breaks correctly, in this combination?
  9. @cstevensjr I have the same question. I can't find it under General Support or Form Builder Support. Where the post was moved to?
  10. kaz

    if query

    @zoeck interesting, I didn't know that in an array the search is different
  11. 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.
  12. @ngrmm works great, thanks for the hint with a variable!
  13. 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?
  14. @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
  15. 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?
  16. @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.
  17. 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?
  18. 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?
  19. @Nicolas great, it works perfectly!
  20. 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
  21. 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.
  22. 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.
  23. 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?
  24. 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?
  25. 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?
×
×
  • Create New...