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

TOPIC:

showing a specific field on each page 16 Jul 2012 12:17 #2802

Basically i want a help box to show on each form that is filled by a predefined text that is pulled from a 'help' table. but i want there to be only one record on this table and for each page to pull out a specific field out of that record. e.g.on the 'products' page there will be a fly view of the text in the 'products help' feild from row '1' and i want it to always display row 1s data. Please help... surly it possible to do this?

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

Re: showing a specific field on each page 20 Jul 2012 12:06 #2832

Please help, there must be a way to do this...

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

Re: showing a specific field on each page 20 Jul 2012 13:04 #2833

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
Can you be more precise please ?
I didn't got the point.

For sure, it doesn't seems complicated.
Coding is now a piece of cake

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

Re: showing a specific field on each page 23 Jul 2012 08:33 #2839

Ok so say i've got a table in my component called 'Help' in which I have a feild for each of the other tables in my component e.g. 'Customers Help', 'Products Help', and 'Meal Categorys Help' each of these is a string. Now what i want is to display these strings on their relevent pages. e.g. On the Customers page I want the string for 'Customers Help' from the 'Help' table to display and on Products page i want the 'Products Help' string to display. also i should add that in the 'Help' table i want it so that their can only be one entry that the user has to edit to change the 'Help' string for each page. I know i could quite easily do something like this using the language files, but i want the user to be able to input their own help text for each page. do you understand what I'm getting at here? would appreciate the help a lot. cheers

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

Re: showing a specific field on each page 23 Jul 2012 08:45 #2840

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
In future, Cook will provide customizable areas of text.

Well.
For now, you need to query your help table for each page.
Add a Where statement (to filter the proper item for each page)
Display the string in each template page.

Do you know how to query and filter easily using the model ?
Coding is now a piece of cake

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

Re: showing a specific field on each page 23 Jul 2012 08:54 #2841

No unfortunatly this is one of the parts of making the component i haven't ventured into yet, if you were able to show me an example i imagine i could work it out?

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

Re: showing a specific field on each page 23 Jul 2012 16:42 #2847

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
Simple :
$db = JFactory::getDBO()  ;
$db->setQuery( "SELECT .....  FROM #__..... WHERE ...." );

$myString = $db->loadResult();	// if you select ONLY ONE data

or 

$myObject = $db->loadObject();	// If you select multiple data columns
Coding is now a piece of cake
The following user(s) said Thank You: cefnllys

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

Last edit: by admin.

Re: showing a specific field on each page 24 Jul 2012 09:49 #2852

Hi sorry to be a further pain, and this is probably really obviouse but alas i am a total noob when it comes to codeing in joomla. I understand your code and what it does but where do i add it, i assume you ment in the relevant item model, but where in that file should i add it too? one of the pre-existing functions? or do i need to create a new function? if so what do i call it or if its to pre-existing function, which one?

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

Re: showing a specific field on each page 24 Jul 2012 10:19 #2855

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
You put this code in your view file (view.html.php) in the display_xxxx() function.
Then, you send the resulted var to the template with :
$this->assignRef('myObject', $myObject);

So, in your template file, you can access the var :
$this->myObject


Do you need help to construct your SQL query ?
Coding is now a piece of cake

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

Re: showing a specific field on each page 26 Jul 2012 11:38 #2906

Hi thanks for the reply I'm still struggling to get it to work though so heres my query:

$db = JFactory::getDBO() ;
$db->setQuery( "SELECT fldproductshelp FROM #__catering_help WHERE id = 1" );

$help = $db->loadResult();

$this->assignRef('help', $help);

Is this correct?...

Then this is what it looks like in the function:

function display($tpl = null)
{
$layout = $this->getLayout();
switch($layout)
{
case 'productsitem':

$fct = "display_" . $layout;
$this->$fct($tpl);
break;
}

$db = JFactory::getDBO() ;
$db->setQuery( "SELECT fldproductshelp FROM #__catering_help WHERE id = 1" );

$help = $db->loadResult(); // if you select ONLY ONE data

$this->assignRef('help', $help);

}

Is this correct?...

Finally I assumed when you say template file that i use the item_fly for that section and i've tried just using:

<?php $this->myObject ?> - Where i want the string to display

and also ive tried:

<?php echo JDom::_('html.fly', array(
'dataKey' => '_lsthelpsave_fldproductshelp',
'dataObject' => $this->help
));
?>

But neither way has worked. Any pointers or any help is really fully appreciated. Have you thought about doing any tutorials for codeing in the component? I understand your really busy with j-cook development but haveing a few tutorials might help slow down the amount of questions being asked in the forums. I find tutorials best for getting concepts and processes to stick in my mind, as long as they have a bit of explanation. anyway any help whatsoever would be amazing! cheers in advance.

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

Re: showing a specific field on each page 31 Jul 2012 06:24 #2936

any additional help would be very much appreciated.

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

Re: showing a specific field on each page 26 Sep 2012 12:51 #4028

I stil can't progress with this concept of putting in where querys into my components, its something i realy need to be able to do to complete multiple components. any help or documentation of any kind would be really really helpfull as there is not much that I can find anywhere on the internet. i think my biggest problem is where to place the relevent code as i am not grasping the MVC architecture of joomla. please any help would be really really appreciated.

Thanks

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

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

Amazing Tool !
And only tool I know that allows complete Scaffolding in terms of component creation. It really saves loads of time (actually much more than that). Simple architecture enables quick and painless changes at any time. Code is clean and consintent. It's just... what's the word... neat! :) Great work! You should definetely try this one!

pi_wo (JED)
         

Get Started