Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: [archived] mtp_subsections
I made another installation in a different database without any prefixes, and the result was the same.
Is there something that I might not have from my web hosting that could have caused this?
Last edited by xjosie729 (2006-08-06 14:05:10)
Josie
Offline
Re: [archived] mtp_subsections
Problem installing table. In debug mode I get this:
Fatal 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 ‘DEFAULT CHARSET=latin1’ at line 9 CREATE TABLE `txp_mtp_section` ( `parent` varchar(128) character set utf8 NOT NULL default ‘Default’, `name` varchar(128) character set utf8 NOT NULL default ‘’, `lft` int(6) NOT NULL default ‘0’, `rgt` int(6) NOT NULL default ‘0’, `sort` int(6) NOT NULL default ‘0’, PRIMARY KEY (`name`), KEY `parent` (`parent`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; in /home/boscarto/public_html/textpattern/lib/txplib_db.php on line 61
Bye
Z
Offline
#33 2006-08-17 17:59:48
- redbot
- Plugin Author
- Registered: 2006-02-14
- Posts: 1,410
Re: [archived] mtp_subsections
Hi, is it possible to modify the plugin so that the list of sections in the “write” tab looks like a nested list of sections and subsections, just like the one under the “subsections” tab?
I’m asking this because I think it would be very useful for the end user to have a visual cue of the sections tree of the site they are updating.
By the way, I think this is a great plugin which could be super with some improvements, like sections/subsections urls…
L.
Offline
Re: [archived] mtp_subsections
I was having the same problem as xjosie729.
Earlier in the thread, Matt mentioned to check if the table, txp_mtp_subsections, existed and had the right content. I checked and found that it didn’t exist… and I’m absolutely sure that I logged-in under an admin account. I tried Installing and Uninstalling then Installing again several times and still get nothing.
Turns out that the table creation wasn’t working in the “Installation”. So I created the table manually, then did the “Install” in the extensions tab. It finally worked and my Presentation > Subsections tab is no longer empty. :-)
I’ve tried this on two separate servers (one WAMP and the other LAMP) and both have the same problem. I can’t verify if my solution works on the LAMP server though cuz I don’t have phpMyAdmin access.
Last edited by bit (2006-08-21 12:49:10)
“The neighboring marshmallow factory fared no better, having been unable to absorb the incredible pressure wave.”
Offline
Re: [archived] mtp_subsections
…I checked again, and didn’t find txp_mtp_subsections, but I did find mtp_subsections under txp_plugins
Josie
Offline
Re: [archived] mtp_subsections
Aha! Found the problem. :-)
On line 360 of the source, remove ENGINE=MyISAM DEFAULT CHARSET=latin1 from the SQL command. After that, try installing the table again in the Extensions tab. If I’m not mistaken, your MySQL should be smart enough to declare the appropriate engine and charset defaults which shouldn’t be a problem for most of us.
It works fine now. :-)
Is it possible that you can have the mtp_section_tree start at the current section? For example, I just set startlevel='?' to do that… if you don’t have the time, I’d be happy to try it myself…
I actually did try to, but I don’t really understand the lft and rgt fields. “Left” and “right”, right? Beyond that, I have no idea. Hehe.
Last edited by bit (2006-08-21 13:47:11)
“The neighboring marshmallow factory fared no better, having been unable to absorb the incredible pressure wave.”
Offline
Re: [archived] mtp_subsections
Thank you SO much. Now it works!
Josie
Offline
Re: [archived] mtp_subsections
bit wrote:
Is it possible that you can have the
mtp_section_treestart at the current section? For example, I just setstartlevel='?'to do that…
It seems that I misunderstood how this works. If I just set $root to $pretext['s'], that would set the root to the current section right? If that’s the case, the following line of code would do what I’m asking for…
if(isset($s) && $root = "?") $root = $s;
Right?
Last edited by bit (2006-08-21 14:03:16)
“The neighboring marshmallow factory fared no better, having been unable to absorb the incredible pressure wave.”
Offline
#39 2006-08-21 16:50:10
- plummerm
- Archived Plugin Author
- Registered: 2006-06-19
- Posts: 22
Re: [archived] mtp_subsections
Hi everyone,
I’m sorry I haven’t been in contact about this plugin. Thanks to everyone for checking into these problems!! I have a preliminary version with support for directories and I was waiting to finish debugging that.
Bit- the “startlevel” and “endlevel” just show what the menu will display relative to its root. Setting those is not the answer for what you want to do. Instead, you can set the root (tag attribute root) to the current section ($pretext[‘s’]). If course, you can’t pass a variable like that into a normal textpattern tag, but you can break the tag into a php function with the attributes elements in an array.
it is like this, i’m out of town and don’t have the code in front of me, so be sure to check the actual name of the tag and attributes with the plugin help(!):
<pre>
<txp:php>
echo mtp_section_tree( array(
‘root’ => $pretext[‘s’],
‘startlevel’ => 1,
‘endlevel’ => 2,
));
</txp:php>
</pre>
and of course that php code would be wrapped in a txp:php tag.
Last edited by plummerm (2006-08-21 16:51:23)
Offline
#40 2006-08-21 16:54:11
- plummerm
- Archived Plugin Author
- Registered: 2006-06-19
- Posts: 22
Re: [archived] mtp_subsections
redbot-
it is absolutely possible. I did that the “easy” way on my TXP by replacing the stock textpattern section_list function with the section list function that is already in the plugin. However, this is a hack, so I didn’t include it with the plugin. If you want to know more, I can tell you in a few days when i have better computer access.
Offline
#41 2006-08-21 16:58:35
- plummerm
- Archived Plugin Author
- Registered: 2006-06-19
- Posts: 22
Re: [archived] mtp_subsections
Oh, and about the lft and rgt- those are not really important for users… I copied it from the category/subcategory code. That is just a nice way of storing how the sections/subsections are built so that the tree is displayed faster.
Offline
Re: [archived] mtp_subsections
Well, it seems that I got it right with if(isset($s) && $root == "?") $root = $s; then. :-P
Actually, it should be more like:
<code>
if($root = ‘?’) {
$root = isset($s) ? $s : ‘Default’;
}
</code>
For the adventurous, this snippet is inserted right after extract($pretext); in the mtp_section_tree function. Setting the attribute, root, to ‘?’ will make the current section the root of the tree. It also gives the nice safeguard of only doing that when a current section is actually set. (Or is this even necessary? Is ‘Default’ the current section in TxP when no section is selected?)
Thanks for the great plugin!
Last edited by bit (2006-08-21 19:26:55)
“The neighboring marshmallow factory fared no better, having been unable to absorb the incredible pressure wave.”
Offline
#43 2006-08-21 19:44:56
- plummerm
- Archived Plugin Author
- Registered: 2006-06-19
- Posts: 22
Re: [archived] mtp_subsections
Hi Bit,
Yeah, that’s a nice method if you don’t mind diving into the code. I may incorporate it or something similar in the next release.
Offline
#44 2006-08-22 01:11:07
- redbot
- Plugin Author
- Registered: 2006-02-14
- Posts: 1,410
Re: [archived] mtp_subsections
plummerm wrote:
redbot-
it is absolutely possible. I did that the “easy” way on my TXP by replacing the stock textpattern section_list function with the section list function that is already in the plugin. However, this is a hack, so I didn’t include it with the plugin. If you want to know more, I can tell you in a few days when i have better computer access.
Thank you for your answer plummerm. So I suppose this is not doable with the plugin, which is what I was hoping for. Anyway I’m still interested, even if I have to hack some txp code (I always try to avoid it) because i’m still convinced this would be a very useful feature.
When you have the possibility I’ll be happy to learn more, thanks again.
Offline
Re: [archived] mtp_subsections
first of all, thanks for your work. appreciated!
are you working on a clean url scheme to reach the content in the subsections? like /sectionparent/sectionchildren etc?
that would be awesome!
Offline