I am quite new to TYPO3, I am inspecting a code for errors and I saw a non working href. the inspection in the browser shows empty href :
<a class="download" target="_blank" title="Initiates file download" href=""> here..</a>
The code is :
<a class="download" target="_blank" title="Initiates file download" href="{location.pdf.originalResource.publicUrl}"><f:translate key="tx_locations_domain_model_location.here" />..</a>
I don't understand this location.pdf.originalResource.publicUrl !!
When I display {location} I get : Locations\Locations\Domain\Model\Location:102
I can't find such path in my folders !!
What am I missing !!
When I make
<f:debug>{location}</f:debug>
I see : pdf => NULL , how can I fix it, in my backend I select a PDF and saved. no error message
UPDATE:
My Pdf field is int(11) unsigned,
Here is my TCA (typo3conf/ext/locations/Configuration/TCA/Location.php)
$GLOBALS['TCA']['tx_locations_domain_model_location'] = array(
....
'columns' => array(
....
'pdf' => array(
'exclude' => 1,
'label' => 'LLL:EXT:locations/Resources/Private/Language/locallang_db.xlf:tx_locations_domain_model_location.pdf',
'config' => array (
'type' => 'group',
'internal_type' => 'file',
'allowed' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],
'max_size' => $GLOBALS['TYPO3_CONF_VARS']['BE']['maxFileSize'],
'uploadfolder' => 'uploads/pics',
'show_thumbs' => 1,
'size' => 1,
'minitems' => 0,
'maxitems' => 1
)
),
here is my Location class :
<?php
namespace Locations\Locations\Domain\Model;
/**
* Location
*/
class Location extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
/**
* title
*
* @var string
*/
protected $title = '';
/**
* fullTitle
*
* @var string
*/
protected $fullTitle = '';
/**
* description
*
* @var string
*/
protected $description = '';
/**
* image
*
* @var \TYPO3\CMS\Extbase\Domain\Model\FileReference
*/
protected $image = NULL;
/**
* secondTitle
*
* @var string
*/
protected $secondTitle = '';
/**
* secondDescription
*
* @var string
*/
protected $secondDescription = '';
/**
* address
*
* @var string
*/
protected $address = '';
/**
* howToGetIt
*
* @var string
*/
protected $howToGetIt = '';
/**
* thirdTitle
*
* @var string
*/
protected $thirdTitle = '';
/**
* thirdDescription
*
* @var string
*/
protected $thirdDescription = '';
/**
* googleMap
*
* @var string
*/
protected $googleMap = '';
/**
* pdf
*
* @var \TYPO3\CMS\Extbase\Domain\Model\FileReference
*/
protected $pdf = NULL;
/**
* pricingtpl
*
* @var int
*/
protected $pricingtpl;
/**
* category
*
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Locations\Locations\Domain\Model\Category>
*/
protected $category = NULL;
/**
* __construct
*/
public function __construct() {
//Do not remove the next line: It would break the functionality
$this->initStorageObjects();
}
/**
* Initializes all ObjectStorage properties
* Do not modify this method!
* It will be rewritten on each save in the extension builder
* You may modify the constructor of this class instead
*
* @return void
*/
protected function initStorageObjects() {
$this->category = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
}
/**
* Returns the title
*
* @return string $title
*/
public function getTitle() {
return $this->title;
}
/**
* Sets the image
*
* @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $image
* @return void
*/
public function setImage(\TYPO3\CMS\Extbase\Domain\Model\FileReference $image) {
$this->image = $image;
}
/**
* Sets the pdf
*
* @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $pdf
* @return void
*/
public function setPdf(\TYPO3\CMS\Extbase\Domain\Model\FileReference $pdf) {
$this->pdf = $pdf;
}
/**
* Removes a Category
*
* @param \Locations\Locations\Domain\Model\Category $categoryToRemove The Category to be removed
* @return void
*/
public function removeCategory(\Locations\Locations\Domain\Model\Category $categoryToRemove) {
$this->category->detach($categoryToRemove);
}
/**
* Returns the category
*
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Locations\Locations\Domain\Model\Category> $category
*/
public function getCategory() {
return $this->category;
}
/**
* Sets the category
*
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Locations\Locations\Domain\Model\Category> $category
* @return void
*/
public function setCategory(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $category) {
$this->category = $category;
}
}
pdf => NULLand you did attach a file in BE it means your data mapping doesn‘t work. Can you post your TCA for fieldpdfand youLocationmodel? - undkoEXT:locations/Configuration/TCA/tx_locations_domain_model_location.php. - undko