Display Image FILENAME in ListPage Fields?

7 posts by 2 authors in: Forums > CMS Builder
Last Post: February 8, 2016   (RSS)

Hello! 

Is is possible to display the Filename of the first image upload in the ListPage Fields so it shows right away with the other info I have on the Editor List Page? (hip, title, owner_name, images) screenshot attached

I've tried a few things but it's not working for me. 

Thanks! Tina

Attachments:

Picture 72.png 42K

Hi Tina, 

If you include the fieldname for the upload in the list page fields field, then a thumbnail of the first image uploaded will appear on the section list page, I've attached a screenshot that shows what the list page looks like, in my example the field name was uploads. If the file uploaded isn't an image file, the file name will be displayed instead. 

Cheers,

Greg

Greg Thomas







PHP Programmer - interactivetools.com
Attachments:

CMS Builder.png 53K

Hi Greg, 

Thanks for the reply, however, I already have the first image thumbnail displaying. What I want is the actual Filename (ie: myhorsephoto.jpg) listed as text in addition to the photo. Is that possible? (it's for reference only, however, a link directly to the original on the server would be nice too) 

I've included a screenshot of what I currently have. I want an additional column displaying the filename of the 1st photo showing.

ALSO **********

The client just requested that I also list the "number of max records" set in the account admin to also be listed as an additional column. Is that possible to link the user's max number of records & their username on this list?

So in the end, the column headers would be:  Hip# | Mule Name | Owner Name | Images | Filename | Max Records | Username

Thanks!! Tina

Attachments:

Picture 73.png 54K

Hi Tina, 

There isn't a simple way you can make the image filename appear in the list section, you'd have to create a plugin that modifies the list page to make it appear instead of the image, you could do this using the plugin hook listRow_displayValue.

There isn't an easy way to make the logged in username and the number of records they can create appear in the header either, a custom plugin would be required for this.

Cheers,

Greg

Greg Thomas







PHP Programmer - interactivetools.com

I was wondering... would it be possible to display those elements on a page instead? Ie: make a record that displays all the users along with the number of max records or permissions allowed? then we could password protect that page and just the client could access it?  Just curious.  :) Thanks!! 

That would be possible, here is some sample code that should point you in the right direction:

  // load records from 'accounts'
  list($accounts, $accountsMetaData) = @getRecords(array(
    'tableName'   => '_accesslist',
    'loadUploads' => true,
    'allowSearch' => false,
    'leftJoin'    => array('accounts' => 'userNum'),
  ));

  foreach($accounts as $account){
    if($account['tableName'] == 'all') { continue; }
    echo "Records {$account['accounts.username']} Created " . mysql_count($account['tableName'], "`createdByUserNum` = '{$account['num']}'")."<br>";
    echo "Records {$account['accounts.username']} Allowed {$account['maxRecords']} <br>";
  }

So the getRecords function retrieves all of the access levels from the database, and links them to the users in the accounts section. Then the code loops through each account and displays the username, the number of records they've created in the section (using the mysql_count function), and the maximum number of records they are allowed to create.

Let me know if you have any questions. 

Cheers,

Greg

Greg Thomas







PHP Programmer - interactivetools.com