332 Posts
Kenneth
9 years ago
4
Topic

Hi,

I've read a lot about this in the old forum, but nobody seems to have solved this (or shared their way of doing so).

I've created a content type. And when I create content with that content type I would like to add it to the menu of the site. 

(I'm not talking about the menu creating when you are creating the content type, but the content for the content type).

Anyone got some ideas on how to succeed with this task?

Get a VIP membership
178 Posts
Jeka
9 years ago
0
Level 1

Hi.

I not sure, but think its possible.

You have to look in menu tables in DB. And that create needed field in your content type with storage in menu tables.

332 Posts
Kenneth
9 years ago
2
Level 1

Thanks. I've tried without luck yet.

There are several of the fields there where I dont understand what they are a reference to, and what should be there. Like the columns "lft" and "rgt". What are they references of? And what should I place in there to make it work as planned? :(

9 years ago
0
Level 2

Hi Kenneth,

Thank you for your post.

You can implement that by using a "before store" or an "after store" field. With this field you should write a php code to add a menu link according to the creation of the new content. You can use variable $config['pk'] to use the id of the created content to define the new menu link.

Regards,
Mehdi.

1283 Posts
Bucklash
8 years ago
0
Level 2

Hi Sebloders

Just thought I'd add a quick explanation for "lft" and "rgt" for those that don't know...

First off, you do not need to worry about these columns in the db, these are taken care of by magic. Once you learn how to read it, it comes in handy for checking nestings...

I have these five categories

Cars
Fruit
- Apple
- - Green
- Banana

Cars would be {lft:1} , it has no sub-categories, so Cars is {rgt:2},

Next is Fruit, {lft:3}, this does have a nested category, so rgt has to wait

Next is Apple, this is {lft:4}, it too has a nested category, so...

Green is {lft:5}. Green also has {rgt:6}.

That is the end of Apple's sub categories, so now Apple can be closed off {rgt:7},

Banana is next {lft:8}, {rgt:9} and then close of Fruit {rgt:10}

Cars {lft:1, rgt:2}

Fruit {lft:3, rgt: 10}

- Apple {lft:4, rgt:7}

- - Green {lft:5, rgt:6}

- Banana {lft:8, rgt:9}

1 - 2

3, 10

- 4, 7

- - 5, 6

- 8, 9

 

It makes sense to me because I wrote it. Hope that makes sense to whoever wants to know it.

Bucklash

Get a VIP membership