TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

April 28, 2024, 02:18:10 PM

Login with username, password and session length
Members
  • Total Members: 3,885
  • Latest: Growner
Stats
  • Total Posts: 195,173
  • Total Topics: 21,219
  • Online today: 130
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 130
  • Total: 130

Undefined index

Started by Lesmond, July 20, 2020, 03:37:30 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Lesmond

Maybe I'm doing something wrong :-[ but I am getting this error when clicking on  General Articles category.

Type of error: Undefined
8: Undefined index: showchild
https://forum.xxxxx.pw/index.php?cat=2
/home/lesmond/public_html/forum/Themes/default/TPsubs.template.php (Line 2103)


SMF 2.1 RC2 --- TinyPortal 1.6.7

lurkalot

Thanks Les.  I just replicated the error on my test site, not seen that one before. 

Type of error: Undefined_vars
Error message:
8: Undefined index: showchild
File: /home/vol11_7/byethost7.com/b7_24299229/htdocs/testsite7/Themes/default/TPsubs.template.php
Line: 2103
URL of page causing the error: http://lts4.byethost7.com/testsite7/index.php?cat=2

Backtrace information
#0: smf_error_handler()
Called from /home/vol11_7/byethost7.com/b7_24299229/htdocs/testsite7/Themes/default/TPsubs.template.php on line 2103

#1: category_childs()
Called from /home/vol11_7/byethost7.com/b7_24299229/htdocs/testsite7/Themes/default/TPortal.template.php on line 142

#2: template_category()
Called from /home/vol11_7/byethost7.com/b7_24299229/htdocs/testsite7/Themes/default/TPortal.template.php on line 38

#3: template_main()
Called from /home/vol11_7/byethost7.com/b7_24299229/htdocs/testsite7/Sources/Load.php on line 2636

#4: loadSubTemplate()
Called from /home/vol11_7/byethost7.com/b7_24299229/htdocs/testsite7/Sources/Subs.php on line 3472

#5: obExit()
Called from /home/vol11_7/byethost7.com/b7_24299229/htdocs/testsite7/index.php on line 176

Lesmond

I never checked the the backtrace info, looks the same on my site...

Code ( Backtrace information) Select

#0: smf_error_handler()
Called from /home/lesmond/public_html/forum/Themes/default/TPsubs.template.php on line 2103
#1: category_childs()
Called from /home/lesmond/public_html/forum/Themes/default/TPortal.template.php on line 142
#2: template_category()
Called from /home/lesmond/public_html/forum/Themes/default/TPortal.template.php on line 38
#3: template_main()
Called from /home/lesmond/public_html/forum/Sources/Load.php on line 2474
#4: loadSubTemplate()
Called from /home/lesmond/public_html/forum/Sources/Subs.php on line 3279
#5: obExit()
Called from /home/lesmond/public_html/forum/index.php on line 154

Lesmond

Could it be because there are no articles under "General Articles" ?

lurkalot

Quote from: Lesmond on July 20, 2020, 05:59:34 PM
Could it be because there are no articles under "General Articles" ?

No don't think so Les, I have articles in my General Category.  I can only replicate the error if I ad a sub cat to General articles.  Regardless of whether they have anything in them it seems to throw the error.

I noticed if I append my site url with ?cat=2 the page that comes up only shows a button with "Portal Features" on it, clicking this results in that error.

Lesmond

I have removed the "Portal Features" category but I am not sure if the error appeared before doing that.

lurkalot

Quote from: Lesmond on July 20, 2020, 06:26:43 PM
I have removed the "Portal Features" category but I am not sure if the error appeared before doing that.

I would leave as is for the moment Les, see if @rjen or Tino can come up with a fix for it, hopefully they can also replicate it.

One thing also noticed, but unrelated.  While trying to replicate this I deleted the sub cat name and saved, there was no way to get back to that category to edit it afterwards, even though it's obviously still there. So that's another issue.  Probably needs some sort of default value. 

@rjen

Quote from: lurkalot on July 20, 2020, 06:12:57 PM
I noticed if I append my site url with ?cat=2 the page that comes up only shows a button with "Portal Features" on it, clicking this results in that error.

That's the default Cat list setting. The page is empty because it does not contain any articles...

I can see the error: it comes up when there is a subcategory created...
Running Latest TP on SMF2.1 at: www.fjr-club.nl

@rjen

Go to the category settings, switch ON the setting show subcategories and save it. Errors will be gone.
It seems the variable is not set on install...
Running Latest TP on SMF2.1 at: www.fjr-club.nl

lurkalot

Quote from: @rjen on July 20, 2020, 08:42:25 PM
Go to the category settings, switch ON the setting show subcategories and save it. Errors will be gone.
It seems the variable is not set on install...

Thanks @rjen, yep switched on "Display any child categories?" and indeed the errors stopped.  O0

@rjen

Quote from: lurkalot on July 20, 2020, 08:55:24 PM
Quote from: @rjen on July 20, 2020, 08:42:25 PM
Go to the category settings, switch ON the setting show subcategories and save it. Errors will be gone.
It seems the variable is not set on install...

Thanks @rjen, yep switched on "Display any child categories?" and indeed the errors stopped.  O0

It actually should not matter what setting you change: it is caused by the variable missing when a new cat is created. Same happens when you create a new cat and not make ANY changes to the settings. Then create a child cat and it happens too...
Running Latest TP on SMF2.1 at: www.fjr-club.nl

@rjen

Attached file fixed it...
Running Latest TP on SMF2.1 at: www.fjr-club.nl

@rjen

Nice, same issue in 2.0.0... I'll fix that too...
Running Latest TP on SMF2.1 at: www.fjr-club.nl

Lesmond

 
Quote from: @rjen on July 20, 2020, 08:42:25 PM
Go to the category settings, switch ON the setting show subcategories and save it. Errors will be gone.
It seems the variable is not set on install...
Thanks mate fixed it for me too,  O0

@rjen

Quote from: lurkalot on July 20, 2020, 07:38:34 PM
One thing also noticed, but unrelated.  While trying to replicate this I deleted the sub cat name and saved, there was no way to get back to that category to edit it afterwards, even though it's obviously still there. So that's another issue.  Probably needs some sort of default value.

That is no longer an issue in 2.0.0: I did already add the 'Edit' icon on the reworked category layout as well. I could do the same in 1.6.x, but we agreed the 1.6 would be a bug-fix branch only, and this is not a bug, more of an 'unrequested-feature'..
Running Latest TP on SMF2.1 at: www.fjr-club.nl

@rjen

This actually makes me wonder: why do we even allow users to create articles and categories WITHOUT a name? Is that something that has a reason? Or is that because in the olden days no one thought to make the names required entry fields?

I am thinking to do that (make them required) to prevent such things from happening at all...
Running Latest TP on SMF2.1 at: www.fjr-club.nl

lurkalot

Quote from: @rjen on July 21, 2020, 08:11:00 AM
This actually makes me wonder: why do we even allow users to create articles and categories WITHOUT a name? Is that something that has a reason? Or is that because in the olden days no one thought to make the names required entry fields?

I am thinking to do that (make them required) to prevent such things from happening at all...

I wondered that too, hence why I said they should have some sort of default value, or it should prevent you from saving it without entering something.

@rjen

I noticed that I creates a default value when you create a new category without a name (-no name-), but it lets you delete it completely afterwards...

On articles something similar happens, but that seems to be more completely implemented.
I guess for categories it should be mandatory to specify a name at all times. What about articles?
Running Latest TP on SMF2.1 at: www.fjr-club.nl

lurkalot

Quote from: @rjen on July 21, 2020, 08:22:19 AM
I noticed that I creates a default value when you create a new category without a name (-no name-), but it lets you delete it completely afterwards...

On articles something similar happens, but that seems to be more completely implemented.
I guess for categories it should be mandatory to specify a name at all times. What about articles?

Or blocks.  ;)

@rjen

Quote from: lurkalot on July 21, 2020, 08:25:14 AM
Quote from: @rjen on July 21, 2020, 08:22:19 AM
I noticed that I creates a default value when you create a new category without a name (-no name-), but it lets you delete it completely afterwards...

On articles something similar happens, but that seems to be more completely implemented.
I guess for categories it should be mandatory to specify a name at all times. What about articles?

Or blocks.  ;)

That's not an answer, but another question  ^-^ ...
So what do you think / want there?
Running Latest TP on SMF2.1 at: www.fjr-club.nl

lurkalot

I was just adding to your question. ;)

What I think is it should not let you save unless you enter something, just give you a error message until you do. That kind of thing.

@rjen

I changed it for articles and cats. The blocks is also mostly done, just the blocks overview page is acting up: it errors on an empty name field but still wipes the name..

Will check out the TPdownloads too, guess that needs the same changes...
Running Latest TP on SMF2.1 at: www.fjr-club.nl

Lesmond

Sorry to have caused all this extra work guys :(

@rjen

Quote from: Lesmond on July 21, 2020, 10:52:01 AM
Sorry to have caused all this extra work guys :(

No problem at all...

Over the last year or so I have been going through the templates and sources to weed out a lot of this stuff, that I think is just 'legacy' and not necessarily there on purpose. In TP 2.0.0 I have corrected as much as I could find: cleaned up a lot of inline styling in the templates, rationalised templates to have identical layout and look and feel to make them easier to understand, but also these kind of improvements: to make it more 'solid'.

Your feedback makes me look at some stuff again that I did not notice before, so much appreciated.

But like I wrote before: we will not be spending any more effort on 1.6.x apart from real bug fixes. All improvements are in 2.0.0...
Running Latest TP on SMF2.1 at: www.fjr-club.nl