populate a fieldlist with joomla articles title

  • Posts: 23
  • Thank you received: 0

greg.o replied the topic: populate a fieldlist with joomla articles title

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.
#235133
  • Posts: 2365
  • Karma: 85
  • Thank you received: 317

mihaela replied the topic: populate a fieldlist with joomla articles title

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
#235136
The following user(s) said Thank You: greg.o
  • Posts: 23
  • Thank you received: 0

greg.o replied the topic: populate a fieldlist with joomla articles title

Oh thank you very much!!!!!!

It works perfectly!!
#235138
  • Posts: 2365
  • Karma: 85
  • Thank you received: 317

mihaela replied the topic: populate a fieldlist with joomla articles title

Great! I'm glad I've helped :)

Regards,

Mihaela
#235141
The following user(s) said Thank You: greg.o
  • Posts: 23
  • Thank you received: 0

greg.o replied the topic: populate a fieldlist with joomla articles title

;-) 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?
#235142
  • Posts: 2365
  • Karma: 85
  • Thank you received: 317

mihaela replied the topic: populate a fieldlist with joomla articles title

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
#235151
The following user(s) said Thank You: greg.o
Moderators: ForumSupporttomeperica
Time to create page: 0.075 seconds

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Summer Sale!

50% discount on all of our extension subscription plans & templates!

Get Your Subscription Here

News and Updates

Get informed about new downloads, updates and more in our News and Updates newsletter.

All Extensions Subscription

Get 1 year access to all of our current and future products and 1 year of professional support -- 99 for just 49! (Summer Sale)

No support per domain or website installation limits! Includes all of our current and future Joomla!® extensions, Joomla!® templates for the duration of your membership. This means, by purchasing an All Extensions Subscription you'll have it all covered!

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!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Community Reward

Help us to create new extensions and plugins! With only $5 you help us a lot and get unlimited download access to all of our products, professional support and even more. Get your reward now!

Read More Here