Posts by kdl

    Yep, as expected (but thought I might be going mad and doubting myself), it is there, listed under Extensions:

    Quote

    Extensions: Core, bcmath, calendar, ctype, date, filter, hash, iconv, json, mcrypt, SPL, pcre, Reflection, session, standard, mysqlnd, tokenizer, zip, zlib, libxml, dom, PDO, bz2, SimpleXML, xml, wddx, xmlreader, xmlwriter, apache2handler, openssl, curl, fileinfo, gd, gettext, mbstring, exif, mysqli, pdo_mysql, pdo_sqlite, Phar, ftp, Zend OPcache

    There must be something failing the function, as, once it is in the !isset element as mentioned above, I just cannot see how it escapes the return -1; item, to then process further.


    Obviously it must work for some people as surely everybody would be on this forum complaining that the Perch Twitter App doesn't work ?


    Thanks for all your responses and a big thank you to your mention about adding /perch/addons/apps/perch_twitter/settings/ to the callback url. This should really be added to the documentation as I've had this issue for ages (never got past the setup and as such gave up on the Twitter App completely for a while).

    Would have done it again, but client is adamant about having Twitter feed on the site and why not, should be fairly simple. Might have to look at other widgets, but at least I've got the Perch App working now, just not an elegant solution, or, inline with Perch. Hate hacking code.

    Ok, so looking into things (and not sure why I am doubting myself but it's been a long frustrating road), it seems I am correct in the fact that JSON is complied in my PHP installation. Infact, I would have done pretty well (or be using a very old version) to have not had.


    I've looked at PerchTwitter.class.php (line 162 - 166), some more:


    Code
    1. if (!isset($item->error)) {
    2. return $item->html;
    3. }
    4. return -1;

    and have come to some form of conclusion. Firstly, I'm not 100% sure how, within the scheme of this file, the process ever gets past the return -1 item to process anything else in the file. Just doesn't quite makes sense to me.


    Removing the above code from the file does allow me to now return and display the tweets without error, just in raw html format.


    As such, changing the tweet.html template to:


    Code
    1. <perch:twitter id="tweetHTML" encode="false" />

    allows the tweets to be rendered in html.


    This now returns the latest 3 tweets, although the formatting is not what I expected, with no options for retweets, follow etc, but I guess I can build a custom template for this.

    Before anyone says it, I do not like editing CORE code, but this fix worked for me. It's not the answer, there is definitely something not quite right with the PerchTwitter.class.php script, but with client pressures and demands, I will try and take a look at this asap and see if I can figure it out, or what infact the offending lines of code are doing.


    Not sure if, when Perch 4 is delivered, a new Twitter App will also be updated, or it will work, but I really wanted to keep using the Twitter App, rather than looking at alternative solutions.


    I love Perch and it's frustrating but these things happen. Surely cannot be the only one who has encountered this problem and hopefully this workaround, albeit I'm sure, temporary will help a few people out.

    I'm running XAMPP Version: 7.0.4, but not sure if this ships as standard install with PHP JSON library or not.


    Is this something that should show up in the extended diagnostics from the Perch installation ?

    ergrge


    Yes, as suspected, I have tried all permutations and still the above line 163 error.


    That is, I have used:


    addons/apps/perch_twitter/settings/


    Your Twitter username (required): @KLSSupportUK and KLSSupportUK


    with:


    PHP
    1. <?php
    2.     perch_twitter_get_latest(array(
    3.         'twitter_id'=>'KLSSupportUK',
    4.         'type'=>'mine',
    5.         'count'=>3
    6.     ));
    7. ?>


    PHP
    1. <?php
    2. perch_twitter_get_latest(array(
    3. 'twitter_id'=>'@KLSSupportUK',
    4. 'type'=>'mine',
    5. 'count'=>3
    6. ));
    7. ?>


    PHP
    1. <?php
    2.     perch_twitter_get_latest();
    3.     perch_twitter_widget_js();
    4. ?>


    The only thing that starts to allow the displaying of the tweets is the removal of the code around stated line 163 in PerchTwitter.class.php.


    The setup is authorising, bringing down tweets with no error anymore (when code removed), so it must be something to do with:


    Code
    1. return $item->html;


    failing, as this, I presume is allowing the tweet to be rendered in html format.

    Hi Drew,


    Removing the @ from the 'Your Twitter username' in the perch twitter settings page, still produces all of the aforementioned errors. It's still failing at this line 163 item within PerchTwitter.class.php.


    I will try going back to using a custom call for the rendering of the tweets, as this was the only place that HAD used the @KLSupportUK name, but I cannot see this being any part of the issue.

    OK MAYBE GETTING SOMEWHERE.


    If I clear the perch3_twitter_tweets table and remove the below code from PerchTwitter.class.php (line 162 - 166):

    Code
    1. if (!isset($item->error)) {
    2. return $item->html;
    3. }
    4. return -1;

    Then press 'Get Tweets', the tweets import without error and I can see the raw html on the site !!!.

    It's something !!!!!!


    So, the Million Dollar Question is, why does the above code trigger all these issues ? and what could I try to resolve it.

    OK MAYBE GETTING SOMEWHERE.


    If I clear the perch3_twitter_tweets table and remove the below code from PerchTwitter.class.php (line 162 - 166):

    Code
    1. if (!isset($item->error)) {
    2. return $item->html;
    3. }
    4. return -1;

    Then press 'Get Tweets', the tweets import without error and I can see the raw html on the site !!!.

    It's something !!!!!!


    So, the Million Dollar Question is, why does the above code trigger all these issues ? and what could I try to resolve it.

    This is getting so frustrating.


    I decided to delete the 'Twitter App' and rebuild it.


    I gave the app the actual site url, but the callback is for my locally hosted version with the additional item route to the settings:


    Quote

    http://[mylocaldomain]/admin/addons/apps/perch_twitter/settings/

    New App Authenticates fine...yay.


    But as soon as I go to retrieve Tweets I get ALL the errors mentioned above, so something is definitely not right, especially if there is a known bug in the Perch Twitter App that requires this additional routing to the callbackURL. Surely other people are finding this. Maybe they are just not using the Twitter App ? Might have to look at some alternative.


    Usual errors when pressing 'Get Tweets':

    Quote

    Notice: Trying to get property of non-object in C:\KDL-Projects\Open\kdl_kls\www\admin\addons\apps\perch_twitter\PerchTwitter.class.php on line 163


    Warning: Cannot modify header information - headers already sent by (output started at C:\KDL-Projects\Open\kdl_kls\www\admin\addons\apps\perch_twitter\PerchTwitter.class.php:163) in C:\KDL-Projects\Open\kdl_kls\www\admin\core\lib\PerchUtil.class.php on line 1405


    Warning: Cannot modify header information - headers already sent by (output started at C:\KDL-Projects\Open\kdl_kls\www\admin\addons\apps\perch_twitter\PerchTwitter.class.php:163) in C:\KDL-Projects\Open\kdl_kls\www\admin\core\inc\top.php on line 17


    The perch3_twitter_tweets table gets updated with all the tweets and I can see them in the Admin (Listing Tweets page), so the app has downloaded and worked, so it MUST be perch side.


    The DEBUG shows:

    Code
    1. Array
    2. (
    3. [type] => 2
    4. [message] => Cannot modify header information - headers already sent by (output started at C:\KDL-Projects\Open\kdl_kls\www\admin\addons\apps\perch_twitter\PerchTwitter.class.php:163)
    5. [file] => C:\KDL-Projects\Open\kdl_kls\www\admin\core\inc\top.php
    6. [line] => 17
    7. )

    which points to this mysterious issue around line 163, but all this has is:

    Code
    1. if (!isset($item->error)) {
    2.     return $item->html;
    3. }



    If I press 'Get Tweets' again (for second time), the errors disappear, but still no display.

    Hmm, interestingly, when I put a new copy onto the live server (temp domain), it doesn't get past the twitter authentication. At the top of the page I get the message "There was an error".


    Debug shows me:


    Code
    1. Array
    2. (
    3. [type] => 2
    4. [message] => Cannot modify header information - headers already sent by (output started at /home/klssupportuk/public_html/admin/addons/apps/perch_twitter/modes/settings.pre.php:59)
    5. [file] => /home/klssupportuk/public_html/admin/core/inc/top.php
    6. [line] => 17
    7. )

    which is a tad odd......

    Yes, the perch3_twitter_tweets table has all the entries in there, so that's not the issue.


    Ok, so I emptied the table. Went back into Perch and reauthenticated the App, which was fine, then when I go to Tweets and hit 'Get Tweets', I get a number of errors.


    Quote

    Notice: Trying to get property of non-object in C:\KDL-Projects\Open\kdl_kls\www\admin\addons\apps\perch_twitter\PerchTwitter.class.php on line 163

    This error repeats itself a number of times...I presume the amount of tweets it's pulled down.


    Quote

    Warning: Cannot modify header information - headers already sent by (output started at C:\KDL-Projects\Open\kdl_kls\www\admin\addons\apps\perch_twitter\PerchTwitter.class.php:163) in C:\KDL-Projects\Open\kdl_kls\www\admin\core\lib\PerchUtil.class.php on line 1405

    The above, which I presume is die to the previous error and then lastly...


    Quote

    Warning: Cannot modify header information - headers already sent by (output started at C:\KDL-Projects\Open\kdl_kls\www\admin\addons\apps\perch_twitter\PerchTwitter.class.php:163) in C:\KDL-Projects\Open\kdl_kls\www\admin\core\inc\top.php on line 17

    which again, I presume is due to the first one, just having the same item called in a different file.


    So, dealing with my first error, if I look at the file PerchTwitter.class.php we get on line 163:


    Code
    1. if (!isset($item->error)) {
    2. return $item->html; <--- THIS IS LINE 163
    3. }


    I had found this post but no resolution, same problem though - http://forum.grabaperch.com/fo…playing-on-site-home-page


    Just a thought, it's not something as daft as windows using forward slashes rather than backslashes ?


    Grasping at straws here.


    I will upload everything to the proper server (this is currently on XAMPP on windows) to see if it works there. STill, there must be loads of people working on local copies (XAMPP) on a PC.

    It's just really odd, I can 'Get Tweets' and I get the green bar with all tweets updated, no errors. I can go into the perch twitter settings and force re-authentication and it brings me back to the site fine, no errors. The DB has the tweets within it, so I would now presume, the strict bit of Twitter has happened and now it's just an issue with Perch rendering them to the screen.

    My light blue tad has '3' in it, as expected.


    I've already reinstalled the twitter app once and I've even got a new copy (download) in-case there had been some update or corruption on download. I've even tried a different users credentials on Twitter to see if I can display other tweets.


    Really at a loss here, as it all seems ok, but just not rendering the retrieved tweets.

    If I'm correct in thinking, the LIMIT statement would 'limit' the records returned, yet, I can see that the template is called and loops 3times, so I presume this element has nothing to do with it.


    I also presume the tweetIsReply item would be driven via Perch itself to navigate through the tweets and pullback just the required items, i.e. only my tweets, include replies, other peoples tweets etc.


    Ahh, yes, slight apologies. I'm pulling tweets back in multiple pages and I have used different calls to retreive the tweets, thinking it might be something to do with this.

    The above SQL statement was a result from the call:


    PHP
    1. <?php
    2.     perch_twitter_get_latest(array(
    3.     'twitter_id'=>'@KLSSupportUK',
    4. 'type'=>'mine',
    5. 'count'=>1
    6. ));
    7. ?>


    So if I go back to the standard call of:


    PHP
    1. <?php
    2. perch_twitter_get_latest();
    3. perch_twitter_widget_js();
    4. ?>


    My debug becomes:


    SQL
    1. SELECT * FROM perch3_twitter_tweets WHERE tweetType='mine' AND tweetAccount='@KLSSupportUK' ORDER BY tweetDate DESC LIMIT 3


    So again, just the tweetIsReply element missing.


    This does not display any records, but if I add some text to the template, I can see on the page that it has looped through 3 times, so it's finding the 'tweet.html' template, but just not rendering the tweets themselves.


    Any ideas ?


    Thanks, really appreciated.

    My debug returns


    SQL
    1. SELECT * FROM perch3_twitter_tweets WHERE tweetType='mine' AND tweetAccount='@KLSSupportUK' ORDER BY tweetDate DESC LIMIT 1

    So the only difference I can see is the:


    AND tweetIsReply=0


    LIMIT 1 element


    I will look into what these elements are doing or how you can adjust them.

    One other item.


    It seems to make no difference at all if I have the code:

    PHP
    1. <?php perch_twitter_widget_js(); ?>

    on my page. I presume this is just how the tweet is rendered, so if I had my own specific template, this would be obsolete anyway.



    Just grasping at why the template is shown, but the 'tweet' content is not. The only item in my template is


    Code
    1. <perch:twitter id="tweetHTML" encode="true" />

    This displays nothing, but all tweets are in admin etc.

    Hi,


    I'm having an issue with getting the Twitter App working and Tweets displaying on my site.


    I've tried it on a production server as well and no joy, but for the purposes of this thread, I will keep to my development XAMPP set-up (windows).


    I have looked at multiple threads on the forum and some have gotten me further than I was, but cutting a long story short, this morning I decided to cut my losses once more and reinstall the Perch Twitter App. I have entered all the clients details into the Twitter App and (using the advice from http://forum.grabaperch.com/fo…-app-authentication-error) added the extra elements to the Callback URL, which had previously removed some errors.


    However, on initial set-up I received the error:


    Quote

    Notice: Trying to get property of non-object in C:\KDL-Projects\Open\kdl_kls\www\admin\addons\apps\perch_twitter\PerchTwitter.class.php on line 163

    along with some other header issues, which, looking at another thread are caused by the above.


    Once past these errors, all the Tweets were pulled in. If I select 'Get Tweets' again, I get no errors and debug shows me nothing.


    I can Force reauthentication and it comes back to the admin not a problem.


    It's almost as if the Tweets are just not being rendered to the screen.

    In my code, I am just using the standard call:


    PHP
    1. <?php
    2. perch_twitter_get_latest();
    3. perch_twitter_widget_js();
    4. ?>


    Which calls the template tweet.html. I can add content to the template such as:


    Code
    1. <perch:twitter id="tweetHTML" encode="false" />Why does this not display

    and on my page I can see:


    Why does this not displayWhy does this not displayWhy does this not display


    which is what I would expect, with the standard install returning the last three tweets, i.e. cycling through 3 times.


    I've tried a custom call:



    PHP
    1. <?php
    2. perch_twitter_get_latest([
    3. 'twitter_id' => '@KLSSupportUK',
    4. 'type' => 'mine',
    5. 'count' => 3,
    6. 'exclude_replies' => 1,
    7. 'template' => 'twitter/tweet.html',
    8. ]);
    9. ?>


    and still no joy.


    All very odd and highly frustrating. This app used to just work out of the box not a problem but dare I say, ever since Twitter changed their policy, this app just never seems to work correctly for me on local or production servers.


    I've added perchDebug and there is nothing coming up on the output either.


    Below is my diagnostics.


    Any help greatly appreciated, surely cannot be only person having these issues.


    Thanks,


    Andy

    Hi,


    This issue seems to be similar to the thread Search for Blog not building proper URL for result


    I have updated Runway to the latest version and I have created a simple search solution to pull results from across the site, be it a standard template created page, or a page from the blog.


    I have two blogs running, namely 'News' and 'Resources'.


    The issue is that when the search pulls back the results:


    Code
    1. <perch:search id="result_url" />


    any page that has been created from the pages templates, i.e. 'admin/templates/pages'. I get the correct, expected url, eg: http://anticoagulationuk.org/prevention


    but any content that is being created from the blog app has a url returned of the format:


    http://anticoagulationuk.org/2…-the-following-indication


    where the actual page is at:


    http://anticoagulationuk.org/n…is-conference-london-2019


    so it is missing the name of the blog, i.e. news or resources.


    Looking at my Settings for the blog, I currently have:


    Site name: /

    Blog post page path: {blogSlug}/{postSlug}

    Slug format: %Y-%m-%d-{postTitle}


    Now, adding news to the post page path:


    Blog post page path: news{blogSlug}/{postSlug}


    will return the correct url, but as I have multiple blogs, I would imagein I need a path along the lines of:


    Blog post page path: {blog}{blogSlug}/{postSlug}


    where {blog} would resolve the name of the blog that the item belongs too, but obviously this is just pseudo made up code and I cannot see if there is an actual piece of code I can use like this to resolve the name of the blog that the content belongs too ?


    Any ideas ?


    Thanks,


    Andy