-
Posts
160 -
Joined
-
Last visited
-
Days Won
2
Everything posted by EyeDentify
-
Hello Again. I Get a "Copy" option on any pages under the Root in pagelist. I am going to uninstall Tracy Debugger and install it again and see what happens. Cause some things have been acting strange like the image upload issue i postet about a short while ago then went away. I will think about the server access thing.
-
I did the following: 1. Empty trash 2. Did a sucessfull field export Did not install the ProcessPageClone because it had no install button, it seems to be manual only. i am not sure how to install it manually. And PW says i have an newer version of the ProcessPageClone in the system "1.0.4?"
-
Oki. Thats unfortunate, because i just changed to one.com ? But everything else seem to work with PW other then the Tracy Debugger. I get this string: "disk_total_space, diskfreespace, exec, system, popen, proc_open, proc_nice, shell_exec, passthru, dl" When i run: <?PHP print_r(ini_get('disable_functions')); ?>
-
Hi @adrian Thanks for getting back to me. I have one.com as host. I am baffled by the double bar as well, but it says AJAX on the other one. I tried to disable Info panel but that did not do any difference to the Console error. Where do i check for the disable_functions list?
-
Hello There @adrian I am having a strange problem with the wonderfull tracy that started a long time ago but i havent notice until now because i have not used it in a while. But i am getting errors about: - The Console Panel - The ProcesswireInfoPanel - The ApiExplorerPanel I will attach screenshots of the errors with some sensitive parts blured out for security. I hope we can resolve this because i love to use the Console. I am running: - Processwire 3.0.153 - Tracy Debugger 4.21.1 - PHP 7.3.16
-
Alot of cloud infrastructure is under stress since many people are working from home and connecting to workplace Cloud solutions and also video conferance systems and such. Most of PW website is hosted in the Cloud so if its under stress it could affect PW website. But this is guessing on my part.
-
Made more testing with the what i thought was the "offending" images field in the first post. And now i created a new test template and added that field to it and tested uploading images to it on a test page. All of a sudden, no error message and the image was deleted as expected. So this is just a very confusing event. I am just glad that its seems to work again. Wanted this thread to be here in case someone else got this problem and wanted a clue to how to solve it. Also Enabling or Disabling the HTML Encoding formating for Filedescription output does not seem to mather which was the first thought after the tip by Dragan. I just leave this here as info for others.
-
Now i have done the following: I think the offending party in this drama was that "Images" field in the orignal Template. I made a new template and a new Images field and transfered images to that, and now it seems to work fine. Do not now why that Images field became corrupt, perhaps after an update to 3.0.139?
-
I did some more investigating because no one seems to know why the error is happening. I did the following. 1. Created an empty template file and uploaded to my PW install. 2. Created a completly new image field 3. Assigned that new image field to my template 4. i Created a hidden page with that template with the new image field 5. Uploaded five test images to that field on that page, saved it 6. Started edit on that page and deleted a random image And for some strange reason there was no error message this time. But the problem resists on the Page i mentioned in my original post. Is there some kind of corruption somewhere i should look for? Maybe i have to remove the page and add it again?
-
Hello Dear PW Gurus. Hope you fair well in these Corona Crisis times. Anyhow, i have a problem with a Cryptic error message that shows up when i am trying to Delete images out of a Images field. The Error message does say a little but it does not make sense to me why i can´t delete the images because of it. Is it some permission issue perhaps? I will attach screenshots of it and what i did prior to it. I am from sweden so ignore the funny words here and there. Hope you all can send me on the right track. i am running PW 3.0.139 on this install. Step1: Step 2: Select the images with the trashcan symbol Step 3: Cryptic Error message I am scratching my head on this one, have not seen this before. Thankfull for all help. /EyeDentify
-
Your Welcome. It´s kind of my thing to try to keep things simple and understandable. Not just for myself but also so other could have use for my code. I will think about the GDPR issue. Have a nice day.
-
Hello Fellow PW fans. Tought i share a simple but usefull way of utilizing the $log system in PW to do simple loging on what IP visit the site and also the HOST. Its not fancy, and its very basic, see it as a boiler plate. You can get all kinds of fancy with it. Remember that the $log system automaticly records the URL from where it was called so we don´t need to supply that to our Entry. I just wanted a simple entry with IP and HOST, the date is also recorded with the entry automaticly. The beauty is that i can watch the logs from the ADMIN page almost in realtime. I am using the "markup regions" output method so i put the code in my _main.php file. You could just put it wherever like to be included with every page load in your site. I hardcoded my logfile to be named ip_log_site but you can use what you feel is better. Also made sure the loging do not happen if your logged in as admin (Super user). See this PW Doc for more info: https://processwire.com/api/ref/wire-log/save/ <?PHP function logIP($session, $log) { /* get IP info */ $ip_adress = $session->getIP(); $host_address = gethostbyaddr($ip_adress); /* log IP adress info NOTE: 'ip_log_site' is a hardcoded name of the logfile, change for your preference. */ $log->save("ip_log_site", "IP: {$ip_adress}, Host: {$host_address}"); } /* if Super User (Admin) do not log */ if(!$user->isSuperuser()) { logIP($session, $log); } ?> Hope anyone have use for it. /EyeDentify
-
<?PHP /* single out with selectors the pages you want to target */ $pageArray = $pages->findMany('template=name_of_template, field_name=value); /* iterate through the selected pages and do something to each of them */ foreach($pageArray AS $key => $myPage) { /* Do something with the page */ } ?> Also check out the documentation for Selectors. They are very powerfull and usefull. https://processwire.com/docs/selectors/ Also check out the API docs for $page https://processwire.com/api/ref/page/ And $pages https://processwire.com/api/ref/pages/ The API docs are my first stop when i am trying to figure out to do something in PW. Good luck.
-
$page->meta() ties data to the page its used on.
EyeDentify replied to EyeDentify's topic in API & Templates
Thats great for you. But still nothing in the documentation suggests that it´s obvious just because its a method of $page. It´s says the data is independent of the fields of the page and such lead me to belive i could call $page->meta() from any page and get the data back that i saved. Anyhow, this post is for the people who don´t think its obvious. We are all different. But thank you for your input Markus. have a nice day and happy coding. -
I have been experimenting with the new $page->meta() method and find it useful. Once i figured out that the data i "save" with it is tied to the page where i called the method from. So this is not obvious at least not for me in the documentation: https://processwire.com/api/ref/page/meta/ So i just wanted to share that revelation with the community so you don´t get as confused as i was. Happy Coding Everyone.
-
How to Use External Library in PW Module? (SOLVED)
EyeDentify replied to EyeDentify's topic in Getting Started
i Would like to thank everyone who gave me tips and advice on this topic. Think i got the gist of it and i will certainly consider everything mentioned. :) /EyeDentify -
Hello There Guys. I am in the process of getting into making my first modules for PW and i had a question for you PHP and PW gurus in here. I was wondering how i could use an external library, lets say TwitterOAuth in my PW module. Link to library https://twitteroauth.com/ Would the code below be correct or how would i go about this: <?PHP namespace ProcessWire; /* load the TwitterOAuth library from my Module folder */ require "twitteroauth/autoload.php"; use Abraham\TwitterOAuth\TwitterOAuth; class EyeTwitter extends WireData,TwitterOAuth implements Module { /* vars */ protected $twConnection; /* extend parent TwitterOAuth contructor $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token, $access_token_secret); */ public function myTwitterConnection ($consumer_key, $consumer_secret, $access_token, $access_token_secret) { /* save the connection for use later */ $this->twConnection = TwitterOAuth::__construct($consumer_key, $consumer_secret, $access_token, $access_token_secret); } } ?> Am i on the right trail here or i am barking up the wrong tree? I don´t need a complete solution, i just wonder if i am including the external library the right way. If not, then give me a few hint´s and i will figure it out. Thanks a bunch. /EyeDentify
-
Hello There Fellow PW lovers. I wanted to share this code that i created to post tweets to the Twitter API in an upcomming project i am working on. And i Thought that everyone could have some use for it. I am using Composer to load the TwitterOAuth PHP library for working with the Twitter API in this code example. Also you need to create an App and have your own API keys ready, you can do that here: https://developer.twitter.com/en/apps The code posts a string and uploads media to be used with the tweet. For the TwitterOAuth methods information see the link above. Note: The paths to the media needs to be local for TwitterOAuth to pick them up and upload them. See this link for filesize limits and other info on media attachements. https://developer.twitter.com/en/docs/media/upload-media/overview <?PHP /* TwitterOAuth API via Composer https://twitteroauth.com/ */ include('vendor/autoload.php'); /* define the classes */ use Abraham\TwitterOAuth\TwitterOAuth; function postTweetUpdate($str = '', $mediaArray = null) { /* Twitter OAuth keys Create your App and find your API keys here: https://developer.twitter.com/en/apps */ $consumer_key = ''; $consumer_secret = ''; $access_token = ''; $access_token_secret = ''; /* init API */ $connection = new TwitterOAuth($consumer_key, $consumer_secret, $access_token, $access_token_secret); if(is_array($mediaArray)) { $mediaIDS = array(); /* Up to 4 media objects can be uploaded. https://developer.twitter.com/en/docs/media/upload-media/overview */ foreach($mediaArray AS $key => $media_path) { /* Upload media to twitter API and get media ID back */ $mediaOBJ = $connection->upload('media/upload', ['media' => $media_path]); /* push uploaded media ID to array */ array_push($mediaIDS, $mediaOBJ->media_id_string); } /* create comma delimited list of media ID:s */ $mediaIDstr = implode(',', $mediaIDS); } /* API params */ $arrayCfg['status'] = $str; $arrayCfg['media_ids'] = $mediaIDstr; /* Make POST request to Twitter API https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-statuses-update */ $statuses = $connection->post("statuses/update", $arrayCfg); /* return payload */ return $statuses; } ?> <?PHP /* string to Post */ $str = 'Test Tweet... ' . PHP_EOL; $str .= '#mytweet' . PHP_EOL; $str .= 'http://www.mywebsite.com' . PHP_EOL; $str .= '' . hash('sha1', mt_rand(0, 1000000)); /* media to upload */ $mediaToUpload[] = 'images/my_image.jpg'; /* make request to Twitter API */ $payLoad = postTweetUpdate($str, $mediaToUpload); ?> <h3>Debug</h3> <pre><?PHP print_r($payLoad); ?></pre> I have the Debug part because its handy to see what is returned from the Twitter API.
-
- 2
-
-
- twitteroauth
-
(and 2 more)
Tagged with:
-
Adding image to Page via API $page->images->add() (SOLVED)
EyeDentify replied to EyeDentify's topic in Getting Started
Thanks to bernhard and Autofahrn i have come up with this example code and run it in TracyDebugger on a test page with a image field and it works beautifully. <?PHP /* get and save a new image to image field Pageimages array */ $page->of(false); $pageImages = $page->images->add('https://www.somesite.com/image_of_tree.jpg'); /* save the page (perhaps not needed but there for comfort.) */ $page->save(); /* get the last added image */ $lastImage = $page->images->last(); /* debug before changes */ d($lastImage, '$lastImage before changes'); /* add tags to the image and description */ $lastImage->addTag('test'); $lastImage->addTag('Tree'); $lastImage->addTag('Syren'); $lastImage->addTag('Sun'); $lastImage->addTag('Sunny'); $lastImage->description = 'This is a beautiful tree.'; /* debug info */ d($page->images, '$page->images'); d($lastImage, '$lastImage'); /* save the page */ $page->save(); ?> I used the following API docs and mentioned forums users help to accomplish this: https://processwire.com/api/ref/pageimage/ https://processwire.com/api/ref/pageimages/ https://processwire.com/api/ref/pagefile/ https://processwire.com/api/ref/pagefiles/ Just wanted to post this at the end so others who wonder about this could get a starting point. -
Adding image to Page via API $page->images->add() (SOLVED)
EyeDentify replied to EyeDentify's topic in Getting Started
Oki. I have to do some testing but i think i got the gist of it. -
Adding image to Page via API $page->images->add() (SOLVED)
EyeDentify replied to EyeDentify's topic in Getting Started
Thanks to Everyone involved with helping me on this subject. Sometimes you can get confused and then need another set of eyes on the problem to figure it out. -
Adding image to Page via API $page->images->add() (SOLVED)
EyeDentify replied to EyeDentify's topic in Getting Started
Ok i got it. But i was refering to changing the Pageimage obj properties that was newly created: https://processwire.com/api/ref/pageimage/#api-construct And then save it. But maybe i should save it, find it, change it and then save it again? -
Adding image to Page via API $page->images->add() (SOLVED)
EyeDentify replied to EyeDentify's topic in Getting Started
I do have TracyDebugger installed, but i did not know i could do that in the TracyDebugger ? You learn something new everyday. Thank you all for helping me understand this. ? -
Adding image to Page via API $page->images->add() (SOLVED)
EyeDentify replied to EyeDentify's topic in Getting Started
Yes ofcourse Sir ? Forgot about the output formating ? But otherwise it seems allright? Could i expect to access the newly created Pageimage object as a return value from: <?PHP $urlToImage = 'http://www.somesite.com/image.jpg'; $pageImageObj = $page->images->add($urlToImage); ?> And do some changes to it before saving or should one save in between?