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

TOPIC:

Getting query's column names 02 Aug 2012 14:39 #2961

Hello,

I am building an html table based on user request. The user is presented with all possible values with a list of checkboxes. The query is built based on checked values.

In order to show appropriate number of columns, I want to evaluate the presence of the column based on the column name. To do this in my first PHP development, I used to used the PHP function mysql_field_name(). How can I achieve something similar in Joomla!, especially in Cook?

Thanks,

José

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

Re: Getting query's column names 05 Aug 2012 15:47 #3000

Maybe you have a look to:
http://docs.joomla.org/How_to_use_the_database_classes_in_your_script
The following user(s) said Thank You: admin

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

Last edit: by e-struct.

Re: Getting query's column names 05 Aug 2012 18:42 #3007

  • VeCrea
  • VeCrea's Avatar
  • Offline
  • Platinum Member
  • Platinum Member
  • Absolute JCook fan
  • Posts: 473
  • Thank you received: 100
Are you familiar with the MVC design pattern (sorry to ask, i just don't know what you already know or don't know so i can point you in the right direction) ?

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

Re: Getting query's column names 06 Aug 2012 08:44 #3020

veCrea, Yes, I am familiar with MVC (although it is not natural to me), and getting able to find my way in the code generated by Cook. I like the way everything is prepared with Cook and want to stay as close as possible with it. There is certainly a way to evaluate based on the third term of JHTML.
JHTML::_('grid.sort',  "SUIVIRM6_FIELD_STATUT", '_statutfiche_.statut', $this->lists['order_Dir'], $this->lists['order'])

Or is there a better way?

Thanks,

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

Re: Getting query's column names 06 Aug 2012 11:32 #3029

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
I think a simple :
<?php if (isset($item->myValue)):?>
	<HTML TABLE HEADER COLUMN>
<?php endif; ?>


...

<?php if (isset($item->myValue)):?>
	<HTML TABLE CELL COLUMN>
<?php endif; ?>
}

For using this, you must be sure the item do not contain the unexpected columns (properties of the item)

Note : you can reuse the JHtml and JDom calls as well of course.
Coding is now a piece of cake

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

Last edit: by admin. Reason: Better syntax

Re: Getting query's column names 08 Aug 2012 08:16 #3067

Admin,

Yes, it does work. It will recognize the presence of the column even if it is empty.

Thanks.

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

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

I have to say your builder is great! We use for another project in a week we have the system built. For the J!Boleto I convert to j3 in 2 weeks :)
Luiz Felipe Weber 

Get Started