Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

[FAQ] Reusing a table in more than one project 13 Feb 2012 01:31 #1249

  • antzog
  • antzog's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 9
  • Thank you received: 0
Hi there,

I have been looking at ways to convert a bunch of 1.5 components to work in J2.5 and Cook seems to be perfect for this so am very excited to have found it.

Our site uses five main tables that contain info that is used in nearly all of our ten components. There are also tables that are specific to certain components. I have been playing with Cook and I can see how to create tables within projects but not how to use a table in more than one project. I would like to keep the components seperate rather than mash them together into one large project.

Could you please advise me whether there is a way in which tables can be used in more than one project/component?

I have had a hunt through the forum (very interesting reading) and cannot see anything on this topic but I may have missed it...

I look forward to the comments of anyone who can offer advice on this as I'm really excited about developing further with Cook.

Thanks
Beaker

Please Log in or Create an account to join the conversation.

Last edit: by admin.

Reusing a table in more than one project 13 Feb 2012 11:57 #1257

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
Cook doesn't do it for you but coding it is very simple.


TODO :

Where you want in (almost) anywhere of Joomla! :
load the model files concerned by your request.
require_once(....);

create a new model instance :

$model_xxxx =& JModel::getInstance('xxxx', 'MycomponentModel');

//FACULTATIVE - Use the model as you want
$model_xxxx->addJoin(...);
$model_xxxx->addSelect(...);
$model_xxxx->addGroupBy(...);
$model_xxxx->addOrder(...);
$model_xxxx->active('predefined', '...');
// END

$items = $model_xxxx->getData();
Coding is now a piece of cake
The following user(s) said Thank You: twev

Please Log in or Create an account to join the conversation.

Last edit: by admin.

Re: Reusing a table in more than one project 13 Feb 2012 14:19 #1269

  • antzog
  • antzog's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 9
  • Thank you received: 0
Thanks for your (very) quick reply. I shall have a go and let you know whether it works for me. My MVC coding skills are limited (hence why I am using Cook!) but fingers crossed I can work it out.

Cheers

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.059 seconds

Dear Cook Team Firstly a massive thank you for your wonderful service!
audibleid (Forum)  

Get Started