symfony backend: displaying thumbnail or photo in listing
if you are using the admin generator to generate your backend application and want to show thumbnail or photo in your listing, you can try the following steps.
Here’s an example of how it will looks like when the thumbnail is showing on the listing page.
Before you add it in, you need to check the variable name of the row that the admin generator uses.
To check the variable name, go to the cache folder for the module and open the _list.php file with a notepad.
Take note of the row
\\cache\backend\dev\modules\autoContestphoto\templates\_list.php ... <?php foreach ($pager->getResults() as $i => $contest_photo): $odd = fmod(++$i, 2) ? 'odd' : 'even' ?> <tr class="sf_admin_row <?php echo $odd ?>"> <?php include_partial('contestphoto/list_td_batch_actions', array('contest_photo' => $contest_photo, 'helper' => $helper)) ?> <?php include_partial('contestphoto/list_td_tabular', array('contest_photo' => $contest_photo)) ?> <?php include_partial('contestphoto/list_td_actions', array('contest_photo' => $contest_photo, 'helper' => $helper)) ?> </tr> <?php endforeach; ?> ...
In my case, the variable name for the row is $contest_photo
Next, create a partial call _thumbnail.php in the template folder of the module.
In this partial, echo the path of the thumbnail or the photo with a img html tag
\\apps\backend\modules\contestphoto\templates\_thumbnail.php <img src="<?php echo $contest_photo->getThumbnailPath() ?>"/>
Then, edit the generator file to include the _thumbnail column for your list
\\apps\backend\modules\contest\config\generator.yml ... list: title: Contest Photo Management display: [=title, contest, category, user, title, isDeleted, _thumbnail] sort: [created_at, desc] max_per_page: 50 ...
Clear your cache and see if the thumbnail loads.
Similar Posts:
- Fix google anlaytics in magento custom template
- Install chinese locale for Magento Admin 1.5
- aheadworks Blog not showing up or empty in Magento
- Installation of Magento CE 2.3.5 in XAMPP Windows 10
- cakephp and wordpress in single domain
Exactly what I have been looking for ! Thanks a lot, this post saved my day !