- Posts: 7
COMMUNITY FORUM
Instantiate K2ItemModel with item id
- Olle Johansson
- Topic Author
- Offline
- New Member
Less
More
15 years 3 weeks ago #75156
by Olle Johansson
Instantiate K2ItemModel with item id was created by Olle Johansson
As far as I can tell, it's only possible to instantiate the K2ItemModel with the id taken from the request.
It would be a good thing if it was possible to do this by sending in an id in as an argument as well. Making it much easier to do stuff like my Jx Include Item plugin.
Is it just something I've missed, or could this be added?
It would be a good thing if it was possible to do this by sending in an id in as an argument as well. Making it much easier to do stuff like my Jx Include Item plugin.
Is it just something I've missed, or could this be added?
Please Log in or Create an account to join the conversation.
- Lefteris
- Offline
- Moderator
Less
More
- Posts: 8743
15 years 2 weeks ago #75157
by Lefteris
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Lefteris on topic Instantiate K2ItemModel with item id
Hi. For which function of the K2ItemModel class are you talking about?
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Olle Johansson
- Topic Author
- Offline
- New Member
Less
More
- Posts: 7
15 years 2 weeks ago #75158
by Olle Johansson
Replied by Olle Johansson on topic Instantiate K2ItemModel with item id
Basically, I'd like to be able to use the K2ModelItem methods for other items than one read from a request variable.
So every method should take an id argument, and use that if available.
E.g.
$K2ModelItem->getData(1337);
So every method should take an id argument, and use that if available.
E.g.
$K2ModelItem->getData(1337);
Please Log in or Create an account to join the conversation.
- Olle Johansson
- Topic Author
- Offline
- New Member
Less
More
- Posts: 7
15 years 2 weeks ago #75159
by Olle Johansson
Replied by Olle Johansson on topic Instantiate K2ItemModel with item id
Never mind, those methods don't seem to all that useful for plugins anyway.
I was kind of hoping to have a method that set all the data up. Like reading the extra fields, creating a link, loading up category item data etc. So I only need one line, instead of 10, or something, to get all relevant data. Doesn't look like there is a method like that, or I'm missing something really obvious.
I was kind of hoping to have a method that set all the data up. Like reading the extra fields, creating a link, loading up category item data etc. So I only need one line, instead of 10, or something, to get all relevant data. Doesn't look like there is a method like that, or I'm missing something really obvious.
Please Log in or Create an account to join the conversation.
- Lefteris
- Offline
- Moderator
Less
More
- Posts: 8743
15 years 2 weeks ago #75160
by Lefteris
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Lefteris on topic Instantiate K2ItemModel with item id
Hi. If you want you can still use these functions. Just try to do something like that:
JRequest::setVar('id',1337);
right before you call the function. Normally i guess that it should work.... Please note that you have to change the correct variable depending on the function. Finally after calling your function you should revert the variable to it's original value so you don't break any other scripts that are waiting this variable from the URL.
JRequest::setVar('id',1337);
right before you call the function. Normally i guess that it should work.... Please note that you have to change the correct variable depending on the function. Finally after calling your function you should revert the variable to it's original value so you don't break any other scripts that are waiting this variable from the URL.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Olle Johansson
- Topic Author
- Offline
- New Member
Less
More
- Posts: 7
15 years 2 weeks ago #75161
by Olle Johansson
Replied by Olle Johansson on topic Instantiate K2ItemModel with item id
Yeah, I know. It just feels wrong having to modify the request variables to use a function.
Lefteris Kavadas said:Hi. If you want you can still use these functions. Just try to do something like that:
JRequest::setVar('id',1337);
right before you call the function. Normally i guess that it should work.... Please note that you have to change the correct variable depending on the function. Finally after calling your function you should revert the variable to it's original value so you don't break any other scripts that are waiting this variable from the URL.
Lefteris Kavadas said:Hi. If you want you can still use these functions. Just try to do something like that:
JRequest::setVar('id',1337);
right before you call the function. Normally i guess that it should work.... Please note that you have to change the correct variable depending on the function. Finally after calling your function you should revert the variable to it's original value so you don't break any other scripts that are waiting this variable from the URL.
Please Log in or Create an account to join the conversation.