TOPIC:

populate a fieldlist with joomla articles title 2 years 2 months ago #235133

  • greg.o
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 49
  • Thanks: 0
I would like the creation date to be displayed after the title.

We will have a lot of choices, it will be easier for people to choose the right title with the date.

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

populate a fieldlist with joomla articles title 2 years 2 months ago #235136

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 415
Hello again,

In that case, a different approach is needed to fetch the data since you are fetching values from multiple rows and columns.

The code should look similar to this:
$this->execPieceByName('ff_InitLib');
$db = JFactory::getDBO();
$db->setQuery('Select title, created From #__content Where catid=2 OR catid=3 AND state =1'); 
 
$result = $db->loadAssocList(); //load the result from the query
$test = "";
for ($i = 0; $i < count($result); $i++)
{
     $test .= "0;".$result[$i]['title']. " ".$result[$i]['created'].";".$result[$i]."\n";
}
 
function ff_setSelectList($name, $value)
{
     global $ff_processor;
     for ($r = 0; $r < $ff_processor->rowcount; $r++)
     {
          $row =& $ff_processor->rows[$r];
          if ($row->name==$name)
          $row->data2 = $value;
          unset($row);
     } // for
} // ff_setSelectList
ff_setSelectList('SELECTLISTNAME', $test);
NOTE: In the code don't forget to replace SELECTLISTNAME with the name of your select list.

Regards,

Mihaela
The following user(s) said Thank You: greg.o

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

populate a fieldlist with joomla articles title 2 years 2 months ago #235138

  • greg.o
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 49
  • Thanks: 0
Oh thank you very much!!!!!!

It works perfectly!!

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

populate a fieldlist with joomla articles title 2 years 2 months ago #235141

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 415
Great! I'm glad I've helped :)

Regards,

Mihaela
The following user(s) said Thank You: greg.o

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

populate a fieldlist with joomla articles title 2 years 2 months ago #235142

  • greg.o
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 49
  • Thanks: 0
;-)you will love me more....

I would like to change the format of the date. I have changed in the language substitutions. It does not work. Do we have to change in the script?

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

populate a fieldlist with joomla articles title 2 years 2 months ago #235151

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 415
Hello again,

That will require a bit more coding.

What exactly do you mean by "I have changed in the language substitutions. It does not work." ? Where exactly have you changed it?

If you wish the date to display in a select list in a different format from how it is saved in the Joomla database, then you should use some PHP code. What you should do is grab $result[$i] variable in the for loop and change the format with a bit of coding.

Take a look at this stackoverflow.com/questions/2487921/conv...yyy-mm-dd-dd-mm-yyyy or this tecadmin.net/convert-date-format-in-php/ since it might help you achieve what you want.

Let me know whether you have managed to make it work.

Regards,

Mihaela
The following user(s) said Thank You: greg.o

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

Moderators: ForumSupport
Time to create page: 0.052 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!