Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#31 2017-03-06 00:00:10

alicson
Member
Registered: 2004-05-26
Posts: 465
Website

Re: txp:article_custom misbehaving?

Fwiw, debug mode is generating these error codes on the Sandbox page:

A problem occurred while loading the plugin: gbp_permanent_links -> Notice: unserialize(): Error at offset 0 of 108 bytes on line 194
textpattern/lib/txplib_misc.php(1368) : eval()'d code:194 unserialize()
GBPPlugin->gbp_serialized()
textpattern/lib/txplib_misc.php(1368) : eval()'d code:123 call_user_func()
textpattern/lib/txplib_misc.php(1368) : eval()'d code:89 GBPPlugin->load_preferences()
textpattern/lib/txplib_misc.php(1782) : eval()'d code:1956 GBPPlugin->GBPPlugin()
textpattern/lib/txplib_misc.php:1782 eval()
textpattern/publish.php:169 load_plugins()
index.php:104 include()
A problem occurred while loading the plugin: gbp_permanent_links -> Notice: unserialize(): Error at offset 0 of 109 bytes on line 194
textpattern/lib/txplib_misc.php(1368) : eval()'d code:194 unserialize()
GBPPlugin->gbp_serialized()
textpattern/lib/txplib_misc.php(1368) : eval()'d code:123 call_user_func()
textpattern/lib/txplib_misc.php(1368) : eval()'d code:89 GBPPlugin->load_preferences()
textpattern/lib/txplib_misc.php(1782) : eval()'d code:1956 GBPPlugin->GBPPlugin()
textpattern/lib/txplib_misc.php:1782 eval()
textpattern/publish.php:169 load_plugins()
index.php:104 include()
A problem occurred while loading the plugin: gbp_permanent_links -> Notice: unserialize(): Error at offset 0 of 108 bytes on line 194
textpattern/lib/txplib_misc.php(1368) : eval()'d code:194 unserialize()
GBPPlugin->gbp_serialized()
textpattern/lib/txplib_misc.php(1368) : eval()'d code:123 call_user_func()
textpattern/lib/txplib_misc.php(1368) : eval()'d code:89 GBPPlugin->load_preferences()
textpattern/lib/txplib_misc.php(1782) : eval()'d code:1956 GBPPlugin->GBPPlugin()
textpattern/lib/txplib_misc.php:1782 eval()
textpattern/publish.php:169 load_plugins()
index.php:104 include()
A problem occurred while loading the plugin: gbp_permanent_links -> Notice: unserialize(): Error at offset 0 of 111 bytes on line 194
textpattern/lib/txplib_misc.php(1368) : eval()'d code:194 unserialize()
GBPPlugin->gbp_serialized()
textpattern/lib/txplib_misc.php(1368) : eval()'d code:123 call_user_func()
textpattern/lib/txplib_misc.php(1368) : eval()'d code:89 GBPPlugin->load_preferences()
textpattern/lib/txplib_misc.php(1782) : eval()'d code:1956 GBPPlugin->GBPPlugin()
textpattern/lib/txplib_misc.php:1782 eval()
textpattern/publish.php:169 load_plugins()
index.php:104 include()
A problem occurred while loading the plugin: gbp_permanent_links -> Notice: unserialize(): Error at offset 0 of 108 bytes on line 194
textpattern/lib/txplib_misc.php(1368) : eval()'d code:194 unserialize()
GBPPlugin->gbp_serialized()
textpattern/lib/txplib_misc.php(1368) : eval()'d code:123 call_user_func()
textpattern/lib/txplib_misc.php(1368) : eval()'d code:89 GBPPlugin->load_preferences()
textpattern/lib/txplib_misc.php(1782) : eval()'d code:1956 GBPPlugin->GBPPlugin()
textpattern/lib/txplib_misc.php:1782 eval()
textpattern/publish.php:169 load_plugins()
index.php:104 include()

It’s the least of my concerns at the moment, as the plugin seems to be working and I have plenty of other errors to keep me busy.. Just thought I’d post this in case it’s of sense to anyone. :)


textpattern.org :: find and share Textpattern resources
docs.textpattern.io :: Textpattern user documentation

Offline

#32 2017-03-06 01:21:31

alicson
Member
Registered: 2004-05-26
Posts: 465
Website

Re: txp:article_custom misbehaving?

Also, gbp_permanent_links seems to be overriding all my regular permlinks to /category/title/ where they’re meant to be /section/id/title/


textpattern.org :: find and share Textpattern resources
docs.textpattern.io :: Textpattern user documentation

Offline

#33 2017-03-06 01:49:33

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 9,726
Website

Re: txp:article_custom misbehaving?

alicson wrote #304410:

gbp_permanent_links seems to be overriding all my regular permlinks to /category/title/ where they’re meant to be /section/id/title/

That’s what happened to me. Thought it was just me being a bit thick and not knowing how the plugin was supposed to be used. But if it’s doing the same for you then it sounds like a bug that needs squashing.

That’ll unfortunately take some debugging time because, frankly, the entire plugin is just voodoo to me. But I’ll see what I can do about it. And those unserialize errors.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#34 2017-03-06 02:48:48

alicson
Member
Registered: 2004-05-26
Posts: 465
Website

Re: txp:article_custom misbehaving?

re: gbp_permanent_links here


textpattern.org :: find and share Textpattern resources
docs.textpattern.io :: Textpattern user documentation

Offline

#35 2017-03-06 07:34:58

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,270
Website

Re: txp:article_custom misbehaving?

alicson wrote #304407:


Thank you! was already on v0.7, however installed your version just to be safe. Looks like the error is still there —likely something else interfering; I’ll try disabling other plugins and leaving glx_if on..

**update: glx_if error persisted even with other plugins off

Tag error: <txp:glx_if_not_category_list> -> Textpattern Warning: tag does not exist while parsing form None on page words...

My bad… maybe… Try adding ->register('glx_if_not_category_list') after ->register('glx_if_category_list') in the plugin code.


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | NeMe @ github | Covid-19; a resource
I do my best editing after I click on the submit button.

Offline

#36 2017-03-06 08:02:17

alicson
Member
Registered: 2004-05-26
Posts: 465
Website

Re: txp:article_custom misbehaving?

colak wrote #304423:

My bad… maybe… Try adding ->register('glx_if_not_category_list') after ->register('glx_if_category_list') in the plugin code.

Really appreciate this! I added the code, and I’m sure twas a good thing, however the error remains.

Tag error: <txp:glx_if_not_category_list> ->  Textpattern Warning: tag does not exist while parsing form None on page words
textpattern/lib/txplib_publish.php:521 trigger_error()
textpattern/lib/txplib_publish.php:463 processTags()
textpattern/lib/txplib_misc.php:4476 parse()
textpattern/publish.php:562 parse_page()
index.php:105 textpattern()

textpattern.org :: find and share Textpattern resources
docs.textpattern.io :: Textpattern user documentation

Offline

#37 2017-03-06 08:05:14

alicson
Member
Registered: 2004-05-26
Posts: 465
Website

Re: txp:article_custom misbehaving?

Oh maybe this can help pinpoint?

Tag error: <txp:glx_if_not_category_list> ->  Textpattern Warning: tag does not exist while parsing form None on page words
Tag error: <txp:glx_if_not_category_list> ->  Textpattern Warning: tag does not exist while parsing form None on page words
Tag error: <txp:glx_if_comments_closed_comments> ->  Textpattern Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND textpattern.Annotate = 0' at line 4 while parsing form @^comments on page words
Tag error: <txp:glx_if_not_category_list> ->  Textpattern Warning: tag does not exist while parsing form None on page words

textpattern.org :: find and share Textpattern resources
docs.textpattern.io :: Textpattern user documentation

Offline

#38 2017-03-06 08:34:42

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,270
Website

Re: txp:article_custom misbehaving?

alicson wrote #304424:

Really appreciate this! I added the code, and I’m sure twas a good thing, however the error remains.

hmmm. Just paste the code below in the plugin. It’s strange as all works fine on my end.

if (class_exists('\Textpattern\Tag\Registry')) {
  Txp::get('\Textpattern\Tag\Registry')
    ->register('glx_if_frontpage')
    ->register('glx_if_not_frontpage')
    ->register('glx_if_section_frontpage')
    ->register('glx_if_not_section_frontpage')
    ->register('glx_if_search')
    ->register('glx_if_not_search')
    ->register('glx_if_category_list')
    ->register('glx_if_not_category_list')
    ->register('glx_if_comments_open')
    ->register('glx_if_comments_closed')
    ->register('glx_if_comments_closed_comments')
    ->register('glx_if_comments_count');
}



function glx_if_frontpage($atts, $thing)
{
    global $pretext;
    return parse(EvalElse($thing, $pretext["s"] == "default" &&
                                  empty($pretext["c"]) &&
                                  empty($pretext["q"]) &&
                                  empty($pretext["pg"])));
}

function glx_if_not_frontpage($atts, $thing)
{
    global $pretext;
    return parse(EvalElse($thing, $pretext["s"] != "default" &&
                                  empty($pretext["c"]) &&
                                  empty($pretext["q"]) &&
                                  empty($pretext["pg"])));
}

function glx_if_section_frontpage($atts, $thing)
{
    global $pretext, $is_article_list;
    return parse(EvalElse($thing, empty($pretext["c"]) &&
                                  $is_article_list == true));
}

function glx_if_not_section_frontpage($atts, $thing)
{
    global $pretext, $is_article_list;
    return parse(EvalElse($thing, !empty($pretext["s"]) &&
                                  $is_article_list == false));
}

function glx_if_search($atts, $thing)
{
    global $pretext;
    return (!empty($pretext["q"])) ? parse($thing) : "";
}

// This function is written by jase
function glx_if_not_search($atts, $thing)
{
    global $pretext;
    return (empty($pretext['q'])) ? parse($thing) : "";
}

function glx_if_category_list($atts, $thing)
{
    global $pretext, $is_article_list;
    return (!empty($pretext["c"]) && $is_article_list == true) ? parse($thing) : "";
}

function glx_if_comments_open($atts, $thing)
{
    global $thisarticle;
    $id = $thisarticle["thisid"];
    $rs = safe_row("*", "textpattern", "ID='$id' AND Annotate=1");
    $output = "";
    if ($rs)
    {
        $output = parse($thing);
    }
    return $output;
}

/*
ignorecomments: If this is set to false the plugin will ingnore any
comments, if set to true the text will only show if there is no
comments already. It is false as default
*/
function glx_if_comments_closed($atts, $thing)
{
    if (is_array($atts)) extract($atts);
    global $thisarticle;
    $ignoreComments = (empty($ignorecomments)) ? false : true;
    $id = $thisarticle["thisid"];
    $output = "";
    $rs = safe_row("*", "textpattern", "ID= $id AND Annotate=0");
    if ($rs)
    {
        if ($ignoreComments)
        {
            $rs2 = safe_row("COUNT( discussid ) AS num_of_comments", "txp_discuss", "parentid = $id");
            if ($rs2)
            {
                if ($rs2[0] == 0)
                {
                    $output = parse($thing);
                }
            }
        }
        else
        {
            $output = parse($thing);
        }
    }
    return $output;
}

/*
If this tag is not enclosed with other tags or text it will output
how many comments that has been recorded before the article was closed.
well, that didnt work very well so that lines are just commented out.
instead just use <txp:comments_count />
*/
function glx_if_comments_closed_comments($atts, $thing ="")
{
    if (is_array($atts)) extract($atts);
    global $thisarticle;
    $id = $thisarticle["thisid"];
    $numOfComments = 0;
    $output = "";
    $rs = getRow("SELECT COUNT( ".PFX."txp_discuss.discussid ) AS num_of_comments
                  FROM ".PFX."txp_discuss
                  LEFT JOIN ".PFX."textpattern ON ".PFX."txp_discuss.parentid = ".PFX."textpattern.ID
                  WHERE ".PFX."textpattern.ID = $id AND ".PFX."textpattern.Annotate = 0");
    if ($rs)
    {
        foreach ($rs as $row)
        {
            if ($row[0] != 0)
            {
                //$numOfComments = $row[0];
                $output = parse($thing);
            }
        }
    }
    //return ($thing) ? $output : ($numOfComments != 0) ? "$numOfComments" : "";
    return $output;
}

/*
This function was requested on the TXP Forum by lee.
It takes two attributes
value: the value to compare with
operator: how to comapare
*/
function glx_if_comments_count($atts, $thing)
{
    if (is_array($atts)) extract($atts);
    global $thisarticle;

    $value = (empty($value)) ? 0 : $value;
    $operator = (empty($operator)) ? "" : $operator;
    $output = "";

    switch ($operator)
    {
        case "equal_to":
            if ($value == $thisarticle['comments_count'])
                $output = parse($thing);
        break;
        case "not_equal_to":
            if($value != $thisarticle['comments_count'])
                $output = parse($thing);
        break;
        case "less_than":
            if ($value < $thisarticle['comments_count'])
            $output = parse($thing);
        break;
        case "greater_than":
            if ($value < $thisarticle['comments_count'])
            $output = parse($thing);
        break;
        case "less_than_or_equal_to":
            if ($value <= $thisarticle['comments_count'])
            $output = parse($thing);
        break;
        case "greater_than_or_equal_to":
            if ($value >= $thisarticle['comments_count'])
            $output = parse($thing);
        break;
    }

    return $output;
}

function glx_if_image_display($atts, $thing)
{
    global $p;
    return parse(EvalElse($thing, !empty($p)));
}
function glx_if_not_image_display($atts, $thing)
{
    global $p;
    return parse(EvalElse($thing, empty($p)));
}

Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | NeMe @ github | Covid-19; a resource
I do my best editing after I click on the submit button.

Offline

#39 2017-03-06 08:41:23

alicson
Member
Registered: 2004-05-26
Posts: 465
Website

Re: txp:article_custom misbehaving?

Thank you, I did that, and also tried again turning off all plugins except for glx_if, and the only difference is that the same error showed up accompanied by all the other tags of the plugins turned off.

does this mean anything useful?

Textpattern Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND textpattern.Annotate = 0' at line 4 while parsing form @^comments on page words

I’m sure it’s not the plugin’s fault; I just don’t know what..


textpattern.org :: find and share Textpattern resources
docs.textpattern.io :: Textpattern user documentation

Offline

#40 2017-03-06 08:47:49

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 9,726
Website

Re: txp:article_custom misbehaving?

alicson wrote #304428:

You have an error in your SQL syntax

Yiannis/alicson: this isn’t anything to do with the registered state of the tag or not. The error message states “tag does not exist”. That’s different to “unregistered tag”. If a tag doesn’t exist it’s either because:

  1. The plugin’s not installed/activated.
  2. The plugin’s type is wrong and isn’t being loaded on the public side.
  3. There’s a syntax error in the code that’s making the plugin not be loaded at all, thus no tags get defined.

In this case my money’s on (3) given the SQL error that alicson is seeing. The tag trace will show you the entire query (temporarily switch gbp_pl off or it swallows the tag trace output for some reason). Look for the one mentioning the plugin and/or textpattern.Annotate in it and paste the query here. That should help us diagnose it.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

Board footer

Powered by FluxBB