Rob(AU)
Members-
Posts
27 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Rob(AU)
-
I have been exploring the link given by @Gideon So which gives a sparse conceptual overview. I can see how to get a PDOStatement object, but my question remains - how to get from there to data that can be used via a template. Can anyone give a brief example? Thanks Rob
-
I am working on a personal project and can't figure this out. The aim is to feed data from a microprocessor into a table in the PW database and then be able to read and display it via the frontend. So far the data is being added to the table, and I can display it via a php file that is not part of PW. The table is called SensorData and includes fields for id, temperature, humidity, dewpoint and reading_time. From what I understand the code below should get the last reading from the table. $lastReading = $this->db->query("SELECT id, sensor, location, temperature, humidity, dewpoint, reading_time FROM SensorData order by reading_time desc limit 1"); How do I display then display that on a page because the data is probably not available to any template?
-
@horst when you said you would write a tutorial I did not expect a short reference manual! Thank you heaps. @wbmnfktr, yes, I eventually found my way here - life delayed my return. This looks awesome and I'm looking forward to using it. At the moment it reveals that I am a better photographer than coder... I have encountered an error at the beginning of step 4. I have tried to tweak the code to reflect my fields and setup, but keep getting an error. I'm testing on my NAS and my setup uses MediaManager and has photo as the photo/image field. Thus I have the following: The following error is thrown: In my current template, using MediaManager, the following produces the expected output: What am I'm missing or doing wrong?
-
@kongondo now that I have had time to explore a bit more it is making more sense - I had a few family things that interrupted ... male, multi-tasking ... epic fail I am using PW 3.0.165 and ran into the images not appearing to upload issue, but only on the live site, but that is not causing an issue now. Is it possible to do something similar to the following using the image media? echo "<img srcset='{$page->image->srcset('2500x0,/2,/3,/4')}' class='mainimageH' alt='$page->headline'>"; I found a way while writing this. It maybe not elegant, but I'm sharing as it may be helpful in the future. From reading the documentation there are hints about image variations. Is this something designed to provide different images sizes for varying viewport dimensions?
-
Having a problem displaying images on the front end. I've just purchased MediaManager and have successfully imported a heap of images. Now I am trying to include a MM image and display it via an existing template. The steps I have followed thus far: 1. Add a new textarea field to the existing template - named PortfolioImage 2. Edit a page and insert a single image into the PortfolioImage field, by selecting a MM image. The image shows up in the edit page. 3. In the template file I added the following line: if($page->PortfolioImage) echo "<img src='{$page->PortfolioImage}' class='mainimageH' alt='$page->headline'>"; 4. The output I get for that line is: <img src='<p><img alt="" class="hidpi" src="/landscapes/site/assets/files/1500/ql033n.jpg" width="1200" /></p>' class='mainimageH' alt='some text'> If I have <img src='{$page->PortfolioImage->url}' instead Tracey Debugger shows this error message: PHP Notice: Trying to get property 'url' of non-object in .../web/landscapes/site/templates/photos.php:10 I am clearly doing something wrong. Can anyone point me in the right direction please? PW 3.0.165, MM 0.1.2, PHP: 7.3.16
-
Thanks Alexander, response was really helpful in getting me to check things I hadn't thought of. I'm not entirely sure what the issue was, and I will keep looking. The issue was solved by using the adminer module to export the live data and import that into the NAS hosted local server. It is working fine now.
-
Hi horst, thanks for the feedback, and I'm please someone comprehended the copyright notice! I, as would others I'm sure, would be very thankful for a tutorial on creating watermarks via a hooked function or property.
-
I am trying to import the database from my live website to my local server. It seems that exporting the website database to a sql file using Ryan's module only copies some cache tables. When on the DB Backups view page the sql file that was exported from the live site, and uploaded to the local server, shows as having 100 tables and 3,00 rows. Yet when I try to restore it the following error shows up: I have exported the database using phpmyadmin, then imported it to the local server using phpmyadmin. That appears to be working, except that I then cannot edit or add pages. The following error come up: Both installations are using ProcessWire 3.0.165, the live server is running PHP version: 7.3.28, and the local server PHP version: 7.3.16. Both use the same (long) password. If anyone can give me some help that would be greatly appreciated!
-
Hi Chris, I have yet to see any issue with image theft. Partly that's probably because the site doesn't get a whole lot of traffic. ProcessWire is far better at handling images than anything else I've used, and I don't utilise it's full potential.
-
Here is my website, built with ProcessWire, and still being refined as I learn more. https://robpackerphotography.com/ My website journey has taken me via plain html, Singapore (anyone remember that?), Wordpress, modx, and now finally PW. Along the way I experimented with drupal, concrete, silverstripe and a few others that I'd rather forget. All self-taught and done between full-time work, family and a passion for photography. I have found using ProcessWire relatively simple - despite the steep learning curve of having to learn about php... The community support is fantastic.
- 6 replies
-
- 16
-
Thanks again Bill, Yes, debugging is turned on, and I'm using Tracy Debugger - neither shows any errors. The live site uses PHP 7.3.27, and the local/NAS is 7.3.16, so I figure they are pretty close. The live site uses MySQL, and the local is using MariaDB 5, but that hasn't been an issue before. UPDATE I have been experimenting, and can edit and save changes to the fields via Adminer, but edits via the usual page editor still do not save to the database. Editing a page via Adminer is fraught with danger though...
-
Thanks Bill, I looked in the logs and found nothing that I think is relevant. The two screenshots show the last error. However, replicating the issue of unsaved edits does not add further entries to the logs. Could there be an issue with the local db having different usernames to the live db - even though my local username for the db has all privileges according to phpmysql? I'm clutching at straws here. Thanks
-
Hi, I am running ProcessWire 3.0.165 on my Synology NAS, along with another couple of test sites. The other sites are working fine. The site will allow me to edit pages, and shows that the edits have been saved (as per the screenshot), but on reloading shows no change. I can however edit templates and fields. The database was imported from my live website (where editing works), and changes of db user etc. made in the site\config.php file. Any help would be appreciated as I have searched the forum for an answer. Thanks
-
This is what I really appreciate about the PW community! I post a question, have dinner and come back to a helpful answer! Thank you teppo. Your explanation helped me learn more about PW. I'm closer, but not quite there. I'm obviously missing something about how to use the module. Using teppo's code: if($page->main_image) echo "<img data-srcset='{$page->main_image->srcset('1500x1000,/2,/3,*1.5')}' class='mainimageH' data-sizes='auto' alt='$page->headline'>"; produces this output, but no image. <img data-srcset='/landscapes/site/assets/files/1216/pnz007n.1500x1000.jpg 1500w,/landscapes/site/assets/files/1216/pnz007n.750x500.jpg 750w,/landscapes/site/assets/files/1216/pnz007n.500x333.jpg 500w,/landscapes/site/assets/files/1216/pnz007n.2250x1500.jpg 2250w' class='mainimageH' data-sizes='auto' alt='sunset at Lake Tekapo on the South Island of New Zealand'> I came back to it this morning, and was able to work around this by using srcset instead of data-srcset. The code that works is: if($page->main_image) echo "<img srcset='{$page->main_image->srcset('0x1000,/2,/3,*1.5')}' class='mainimageH' alt='$page->headline'>";
-
I've just discovered this module and am unable to get any images to show from it. My setup is on localhost using php 7.3, PW 3.0.165 with lazysizes. The code in my template is: if($page->main_image) echo "<img data-srcset='$page->main_image->srcset('1500x1000,/2,/3,*1.5')' class='mainimageH' data-sizes='auto' alt='$page->headline'>"; No image is shown and the output I get is: <img data-srcset='pnz007n.jpg->srcset('1500x1000,/2,/3,*1.5')' class='mainimageH' data-sizes='auto' alt='sunset at Lake Tekapo on the South Island of New Zealand'> My guess is it is something simple that I'm missing ? I too would really like to see this support WebP.
-
Hi Ben, I've been using another Payments module. Am I understanding correctly that yours does not depend on the PaymentModule? If not I can uninstall the unused modules ... Thanks
-
Hi Adrian, currently it is set at: memory_limit 768M Is that going to be enough? The site has less than 200 pages. Thanks
-
I am having issues with my site being very slow, for both the front and back end. Having researched and looked at previous posts on the topic has not helped, but the threads I could find were from a while ago. The error I'm getting in the Exceptions Log is: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away In /wire/core/WireDatabasePDO.php line 499 Tech support for my hosting investigated and could not see any MySQL issues. At the same time, the dev copy of the site on my localhost is also going slow. Another site on my localhost is working as normal, so that seems to eliminate the hosting as a problem. I am hoping someone can shed some light on what might be causing this. Thanks
-
How to include data from another related field
Rob(AU) replied to Rob(AU)'s topic in API & Templates
Thank you MoritzLost, you understood the structure correctly. I see now how to access the ingredientType field for each of the ingredients included in the repeater. How do I include / append that data in the array from the repeater to then do the sort? -
Hi, I am learning PHP while in the process of building a recipe website and enjoying the challenge. One dilemma has stumped me. I have an Ingredients List page, which is parent to a series of ingredient pages. The ingredient pages has two fields, Title and ingredientType (for spices, dry, wet, vegetables etc). Thus there is one list of Ingredients available to be included in recipes. On the Recipe template there is an Ingredients Repeater field that includes fields for quantity and extra details (like room temperature for butter for example) as well as the ingredient field. If I include the ingredientType field in the repeater it shows as a blank field rather than showing the data saved from the ingredient page. It looks a little like this: Ingredients List page ingredient page - title field - ingredientType field Recipe page title field description field Ingredients repeater field quantity field ingredient field ingredient details field What I want to do is be able to include the ingredientType field in the array that the Recipes template uses to output the Recipe page. I will then use the ingredientType to sort the Ingredients Repeater data for output. Conceptually this could either be at the adding a new recipe stage, or by somehow adding the ingredientType data to the array used for page output. I just can't work out how to do it. Any clues would be greatly appreciated.
-
solved - how to save $pages array for later use
Rob(AU) replied to Rob(AU)'s topic in General Support
I have found a solution and thought I would share it for the benefit of others. It may not be the most efficient or elegant solution but it is working. After some trial and error the solutions suggested in topic 7659, especially by formulate, began to make sense. In the tagging.php template file is the following code: $fullList = $pages->find("$searchTxt=$thisTag"); // this select all pages where page field "Tags" contains a page with title of our tag $tagList = $pages->find("$searchTxt=$thisTag, limit=10"); // this selects the same as above but limits the rsults for pagination $session->taggedPages=(string)$fullList; // save the result of the first search for use in the portfolio template In the portfiolio.php template file the following gets the prev / next pages from the tag search: $fullList=$pages->find("id=" .$session->taggedPages); $next = $page->next($fullList); $prev = $page->prev($fullList); This means that going to the prev / next page is not limited to those paginated on the tagging page. I hope that makes sense and helps someone else. -
solved - how to save $pages array for later use
Rob(AU) replied to Rob(AU)'s topic in General Support
Thank you horst, that solved an issue I was yet to solve. dragan, your clue was too cryptic for my limited knowledge. PW is certainly easy to work with if you are prepared invest some thought. My issue is not solved, but that's because I didn't describe it clearly enough. The page with the thumbnails (now paginated!) lists all the images with the selected tag. It is based on my tagging template. Clicking a thumbnail opens a page based on my portfolio template for the individual image, each of which has it's own page. What I would like to do is have the prev/next links on the individual, portfolio template styled page move through the images that were on the tagging page. This will change depending on the selected tag, and will be different to where the images sit within the content tree. How would this work in PW? I have a sense that it involves sessions ... but have not been able to work it out. -
I am building a portfolio site based on PW 3.0.124 and learning php as I go. The site uses various tags on the pages for each image. The tagging is sorted and clicking a tag link brings up a page of links to images with the same tag using the following code: $searchTxt = $page->searchTag; $thisTag = $page->name; // Current clicked tag $tagList = $pages->find("$searchTxt=$thisTag"); // select all pages where page field "Tags" contains a page with title of our tag I have a Prev / Next section on the image pages, but it relates to the tree location, rather than the tagList page. My guess is that the $tagList array needs to somehow be saved to be used to iterate through it, possibly using sessions ... but I can't figure out how to do that. Any help/pointers would be appreciated.
-
Thanks wbmnfktr, you put me on the right track. I had WireMail: SMTP installed but not configured. I actually uninstalled the module and emails are now being sent. I am having an issue where an email is sent to my address, but not to the person using the Contact form. The following is in the contact page template: <?php $scf = $modules->get('SimpleContactForm'); $options = array( 'btnClass' => 'butn1', 'btnText' => 'Send', 'emailMessage' => 'You have successfully sent a message to Rob', 'item_label' => "", 'classes' => array( 'item' => 'input-field' ) ); echo $scf->render($options); ?> <br ><br ><br ></div> </div> <?php include('./includes/foot.inc'); ?> Any clues would be appreciated.
-
I have installed the module and the page appears as expected. The submit button works and redirects to the success page, or not if it detects spam. No emails are sent and I get the following errors in the log: [ERROR] Mail has not been sent to Name [ERROR] Additional mail could not be sent to Name running PW 3.0.123 on PHP 7.1.31 I have searched the forum for a solution. Can anyone suggest where else I might look to solve this?