Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-12-07 11:20:21

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Notice: Undefined variable: Section ...

Brand new vanilla 4.3.0 site.

Stripped out all the sections (articles, archive etc.).

Added an article and the following is shown next to the “view” link in the Write tab:

Notice: Undefined variable: Section in .../textpattern/publish/taghandlers.php on line 3401

and the “View” link goes to:

http://…//2/home-welcome

(Absolute paths … edited out)

Note the missing “default” section bit. And the section dropdown is empty.

Problem goes away if a second section is added – default then appears in the dropdown (along with the newly added section) & the article can be assigned to a section.

Not a big problem but I thought I’d mention it.

Offline

#2 2010-12-07 11:42:21

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,447
Website GitHub

Re: Notice: Undefined variable: Section ...

gomedia wrote:

Stripped out all the sections (articles, archive etc.)… Notice: Undefined variable: Section in .../textpattern/publish/taghandlers.php on line 3401

My guess is that crops up since you can’t (in theory) directly assign an article to the default section as it’s your front page and can only pull in articles from elsewhere. But I’m intrigued by:

Problem goes away if a second section is added – default then appears in the dropdown (along with the newly added section) & the article can be assigned to a section.

Under regular operation I can’t see default as an option in the Section dropdown on the Write panel. Are you saying that it appears if you delete all Sections and then add one? If so I’d say that’s probably a bug. It may be to do with the ‘Selected by default’ radio button: perhaps if there is no section selected by default then ‘default’ appears in the list? (stab in the dark)


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

#3 2010-12-07 23:28:20

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: Notice: Undefined variable: Section ...

Bloke wrote:

Under regular operation I can’t see default as an option in the Section dropdown on the Write panel.

You’re right, I’m confusing things a bit.

Are you saying that it appears if you delete all Sections and then add one? If so I’d say that’s probably a bug. It may be to do with the ‘Selected by default’ radio button: perhaps if there is no section selected by default then ‘default’ appears in the list? (stab in the dark)

If default is the only section then the section dropdown list is empty. If I then add an article, it seems to be assigned to a blank section and the error message is displayed.

Offline

#4 2010-12-07 23:41:44

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,447
Website GitHub

Re: Notice: Undefined variable: Section ...

gomedia wrote:

If default is the only section then the section dropdown list is empty. If I then add an article, it seems to be assigned to a blank section and the error message is displayed.

Right, that’s what I’d expect. In a sort of “I wouldn’t expect it to generate an error, but it’s kind of half justified in doing so because you’ve assigned an article directly to no section, which the code didn’t expect could happen”.

Not sure if there’s an elegant way round it, aside from hiding the error message :-) The interface can’t very well stop you assigning an article to no section if you’ve not defined any, short of:

  1. hiding the Write panel
  2. disabling the Publish button
  3. refusing to save the article if the section is empty

Hmmm. But imagine if you hadn’t noticed the visual cues and your article wasn’t/couldn’t be saved… you’d be faced with having to lose your edits, or visit the Sections panel in another browser tab, set one up, revisit the Write panel, use one of the vertical buttons to force a refresh of the page, go back to Text view, assign the new Section and then Save. But of a rigmarole either way. Half PEBKAC, half software fault.

A difficult one for sure. Easiest solution: don’t delete all Sections :-) At least until something usable can be figured out to counteract this code assumption. Any neat ideas?

Last edited by Bloke (2010-12-07 23:43:55)


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

#5 2010-12-07 23:51:44

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: Notice: Undefined variable: Section ...

Bloke wrote:

A difficult one for sure. Easiest solution: don’t delete all Sections :-)

Yes, it’s a bit of an odd situation. Normally on a new website I’m banging in sections like there’s no tomorrow but this is a “can you get something simple up for us before Christmas” special!

At least until something usable can be figured out to counteract this code assumption. Any neat ideas?

Dunno. Adjust the “lame, huh?” line of code to cope with an uninitialised $Section – maybe set it to empty?

Offline

Board footer

Powered by FluxBB