Jump to content

Andy

Members
  • Posts

    118
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Andy

  1. Hi @Manaus Why don't you use a function? <?php namespace ProcessWire; /* * * /site/templates/_func.php * use include_once in your code template */ function my_render_link($selector) { $current = wire('pages')->get($selector); if($current->id){ $out = "<a href='".$current->url."'>".$current->title."</a>"; }else{ $out = false; } return $out; } ?> I haven't tested but should work.
  2. Hi @bently76 Your request is not entirely clear to me. We are here discussing situations related to the CMF ProsessWire. And you work on CMS Wordpress. These are slightly different universes.
  3. @CBE The method of accessing other pages certainly works. Perhaps you have an error somewhere or access to the page is denied. There is little information on this here. Try to break the task into steps, check it step by step. $my_page = $pages->get('/general-information/'); if($my_page){ $my_img = $my_page->front_image; if($my_img){ $my_url = $my_img->url; }else{ echo "Image not acces"; } }else{ echo "Page not acces"; } Or just see what PageArray returns to you $my_page = $pages->get('/general-information/'); if($my_page) print_r($my_page); // use var_dump($my_page) for bit more info
  4. @CBE The fact is that the image field can be either for a single picture or for an array of pictures. Check how you set the image field for front_image. Read more about this in the documentation. But in short. For a single picture, the call will be like this: $image = $page->single_image; if($image) echo "<img src='$image->url'>"; For an array of pictures, you can choose the first one: $image = $page->images->first(); if($image) echo "<img src='$image->url'>"; Look to Maximum files allowed and Formatted value
  5. @kaz Add two flags to options and play with it: 'scrollWheelZoom' => false, 'dragging' => false, I usually use this configuration. $options = array('markerIcon' => 'flag-checkered', 'markerColour' => 'orange', 'scrollWheelZoom' => false, 'dragging' => true, 'markerTitleField' => '', 'popupFormatter' => function($page) { $out[] = "<center><strong>Sub Header</strong></center>"; $out[] = "<center><img src=\"/images/logo.png\" width=\"100\" height=\"100\" /></center>"; // ** NB: Use escaped double quotes if HTML attributes needed ** return implode('<br/>', $out); } ); In this case, zooming in and out of the map is possible only with the zoom buttons at the top left. But the swipe movement of the card is preserved. For a desktop, this is ideal. And for smartphones dragging the site up on the map picture is replaced by dragging the map up. The user understands this and is looking for a place behind the map in order to hook his finger on the page, not the map. Disabling dragging does not fix the problem. The map does not move, but the page does not move either. The user still needs a place behind the map to swipe.
  6. @teppo and @VeiJari I would also remind you that there is a SQL injection.
  7. @kaz If You put default then $options = array('markerIcon' => 'flag-checkered', 'markerColour' => 'orange', 'popupFormatter' => function($page) { $out[] = "<center><strong>Sub Header</strong></center>"; $out[] = "<center><img src=\"/images/logo.png\" width=\"100\" height=\"100\" /></center>"; // ** NB: Use escaped double quotes if HTML attributes needed ** return implode('<br/>', $out); } ); And yours Main Header will be as link But if you add the parameter 'markerTitleField' then the field with the link will disappear. $options = array('markerIcon' => 'flag-checkered', 'markerColour' => 'orange', 'markerTitleField' => '', 'popupFormatter' => function($page) { $out[] = "<center><strong>Sub Header</strong></center>"; $out[] = "<center><img src=\"/images/logo.png\" width=\"100\" height=\"100\" /></center>"; // ** NB: Use escaped double quotes if HTML attributes needed ** return implode('<br/>', $out); } ); You can see the result. It seems to me that this is exactly what you wanted to get. Without fixing the module codes.
  8. @horst Gotcha - https://github.com/millipedia/millco-diceware
  9. @kaz I think you need to look at the fields in the map options. $map_options = array( 'markerLinkField' => 'url', 'markerTitleField' => 'title' ); In the README.md file `markerLinkField` | Page field to use for the marker link, or blank to not link (type: string; default: url) `markerTitleField` | Page field to use for the marker title, or blank not to use a marker title (type: string; default: title)
  10. @Simi Problem solved. PHP 7.4 ZIP extension option --enable-zip was removed. You need to manually install Zip and ZipLib in PHP. The rest of the access rights must also be set. But, I still do not understand why errors are not displayed in the log file? Make sure /site/assets/cache/ directory is writeable for PHP. Make sure your site modules directory (/site/modules/) is writeable for PHP. ZipArchive class is required and your PHP does not appear to have it.
  11. @Simi I have the same situation when using PHP 7.4. And no configurations and folder permissions fix this. When using PHP 7.3 (and earlier) modules are loaded normally.
  12. Russian language packs for the LoginRegisterPro module version 5 Includes InputfieldFrontendFile 1a and FileValidatorImage 0.0.3 Языковые пакеты для модуля LoginRegisterPro версии 5 Включает InputfieldFrontendFile версии 1a и FileValidatorImage версии 0.0.3 (updated) ru-RU-LoginRegisterPro-v5.zip
  13. Another problem with RestAPI. When loading large files, an error occurs. In the backend everything is fine, a 300 MB file is loaded normally. The problem only occurs when testing through Insomnia or Postman with files larger than 15 mb. We managed to solve the problem. It is necessary to include AJAX in the file properties. $ul = wire(new WireUpload($formName)); $ul->setValidExtensions(['mp4', 'avi', '3gp']); $ul->setMaxFiles(1); $ul->setMaxFileSize(100 * 1000000); // 100 MB $ul->setOverwrite(true); $ul->setDestinationPath($p_path); $ul->setLowercase(true); $ul->setAllowAjax(true); $files = $ul->execute();
  14. @thomasaull Array merging may help $headers = array(); $header_variables = array_merge($_SERVER, getallheaders()); foreach($header_variables as $key => $value) { $headers[strtolower($key)] = $value; } Since you require in your module PHP>=7.2.0, ProcessWire>=3.0.98 The getallheaders() function is definitely present.
  15. @thomasaull I will try, although I do not have such experience with github. And I'm not sure that all my suggestions are useful. Maybe I'm wrong somewhere.
  16. @thomasaull I continue to test this module which is very suitable for me. JWT token. Problem with authorization. Apache2 server and PHP 7.3.10. Can't auth and gives a message: No Authorization Header found' and code 400. This is a problem in Router.php function private static function getAuthorizationHeader() $headers = array(); foreach($_SERVER as $key => $value) { $headers[strtolower($key)] = $value; } Where variable $_SERVER have no authorization variable. If you change this to a function, it will work. foreach(getallheaders() as $key => $value) { $headers[strtolower($key)] = $value; } The following error occurs if you enter an invalid token. { "error": "Error: Exception: Signature verification failed (in \/localhost\/site\/modules\/RestApi\/Router.php line 131)\n\n#0 \/localhost\/site\/modules\/RestApi\/Router.php(91): ProcessWire\\Router::handle('ProcessWire\\\\Exa...', 'getUser', Object(stdClass), Array)\n#1 \/localhost\/site\/modules\/RestApi\/RestApi.module(50): ProcessWire\\Router::go()\n#2 \/localhost\/wire\/core\/WireHooks.php(924): ProcessWire\\RestApi->checkIfApiRequest(Object(ProcessWire\\HookEvent))\n#3 \/localhost\/wire\/core\/Wire.php(450): ProcessWire\\WireHooks->runHooks(Object(ProcessWire\\ProcessPageView), 'execute', Array)\n#4 \/localhost\/index.php(61): ProcessWire\\Wire->__call('execute', Array)\n#5 {main}. File: \/localhost\/index.php:70" } It seems to me that it would be right to replace Router.php line 131 with code 500 catch (\Throwable $e) { throw new \Exception($e->getMessage()); } Can be replaced by catch (\Throwable $e) { self::displayError('Signature verification failed', 400); } This will be more correct, as the token error is a request syntax error and this is code 400.
  17. @thomasaull It seems I found what was the mistake. It was necessary to transfer the dispatch from Insomnia to the multipart format and set the file name. After that, in the $_FILES variable you can find all the data to get the file. $_FILES Array( [upfile]=>Array( [name]=>hot-pizza.jpeg [type]=>image/jpeg [tmp_name]=>/localhost/tmp/phptAUnX5 [error]=>0 [size]=>65639 ) )
  18. @thomasaull When you set up the site configuration. In file /site/config.php change the row to true and you will see backend debugging capabilities. /*** SITE CONFIG *************************************************************************/ /** * Enable debug mode? * * Debug mode causes additional info to appear for use during dev and debugging. * This is almost always recommended for sites in development. However, you should * always have this disabled for live/production sites. * * @var bool * */ $config->debug = true; Thanks for the answer on downloading the file in the Processwire. I don’t understand very well how API communication works. But your module perfectly illustrates this feature. I managed to transfer any information from the site through the API. But I can’t transfer a file through your module to site. When we submit a file from the form, we have identifiers <input type="file" name="uploadedFile[]" id="uploadedFile" multiple> And we can find it in global wire('input') or $_GET, $_POST. But in our case this is empty wire('input')->post->upload
  19. This module is very useful unconditionally. Could you add an example of uploading a file to the server in the README.md. I just can’t understand how this is implemented in your module.
  20. I absolutely agree with you. Do not touch the /wire/ directory if you are not a developer of this. However, the customer really wanted the differences between the front-end and back-end icons. This is really convenient when you can see in a browser in which mode you opened them. And adding the icon to the /wire/ was the fastest but the wrong way. Adding such functionality to the admin template will be very useful.
  21. When using RestAPI, I found the following error in the debug page. (RestApi 0.0.7 ProcessWire 3.0.148)
  22. Find in version 3.0.148. AdminThemeUikit has changed. in _head.php was <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="icon" href="/wire/Favicon.ico" type="image/x-icon" /> <title><?php echo $adminTheme->getBrowserTitle(); ?></title> now <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title><?php echo $adminTheme->getBrowserTitle(); ?></title> Now we can't use different favicon for the main site and for the editing mode. Prior to this case, it was convenient to distinguish between operating modes.
  23. I have AdminThemeBoss 0.6.3 I like this design. And find problem with announcement. They close main button. Another problem is the debug panel that now opens under the footer. Perhaps these are problems of my configuration.
  24. This is a very useful set of tools. But I have a problem and I am looking for which tool will help to solve it. Is there such a function as copying one field of a repeater to another field of a repeater on the same page? For example, the situation is as follows: -I have a repeater field for which I want to change the template without losing the values. -I make a new repeater field with a different name, but with the same fields and add it to the page template. -I need to copy all the values from the first field of the repeater to the second. It’s like the "Page Table to Repeater/Repeater Matrix" function or "Copy Repeater Items To Other Page" function. Sorry if I'm off topic.
  25. Try this. Closed admin pages has_parent!=2
×
×
  • Create New...