I have an Extension which holds a list of PDF-Docs.
In my TCA I defined the uploadfolder, but after uploading a file, it goes to "fileadmin/user_upload". Not to my defined folder "fileadmin/user_upload/my_folder"
My TCA
'pdfs' => array(
'exclude' => 0,
'label' => 'LLL:EXT:xxx/Resources/Private/Language/locallang_db.xlf:xxx_domain_model_pdflist.pdfs',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig( 'pdfs',
array(
'maxitems' => 200,
'max_size' => 5000,
'uploadfolder' => 'fileadmin/user_upload/bffpdf',
'show_thumbs' => 1,
'size' => 20,
'minitems' => 0,
),
'pdf'
),
),
The Folder exists and is shown up in the Fileadmin.
I do not want to override the userdefault uploadfolder.
Greetz
Thomas
Am not familiar with typo3, but my following code works perfect for me, I think this may help you.
My TCA
'image' => array(
'exclude' => 0,
'label' => 'LLL:EXT:titech_catalog/locallang_db.xml:tx_titechcatalog_category.image',
'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/tx_titechcareers',
'show_thumbs' => 1,
'size' => 1,
'minitems' => 0,
'maxitems' => 10,
)
)
Code to create this path is in 'ext_emconf.php' file,
'createDirs' => 'uploads/tx_titechcareers/rte/',
Related
First post type :
add_action( 'init', 'create_pressrelease' );
function create_pressrelease() {
register_post_type( 'pressreleases',
array(
'labels' => array(
'name' => __( 'Press Releases' ),
'singular_name' => __( 'Press Release' )
),
'has_archive' => true,
'show_in_menu' => 'edit.php?post_type=storefronts',
'public' => true,
'map_meta_cap' => true,
'menu_position' => 4,
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'revisions' ),
'taxonomies' => array( 'post_tag' ),
'menu_icon' => 'dashicons-edit',
'has_archive' => 'pressreleases',
'with_front' => false,
'rewrite' => array(
'slug' => 'suppliers/%supplier_name%/pressreleases',
)
)
);
}
Second post type :
add_action( 'init', 'create_whitepaper' );
function create_whitepaper() {
register_post_type( 'whitepapers',
array(
'labels' => array(
'name' => __( 'White Papers' ),
'singular_name' => __( 'White Paper' )
),
'has_archive' => true,
'show_in_menu' => 'edit.php?post_type=storefronts',
'public' => true,
'map_meta_cap' => true,
'menu_position' => 4,
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'revisions' ),
'taxonomies' => array( 'post_tag' ),
'menu_icon' => 'dashicons-edit',
'has_archive' => 'whitepapers',
'rewrite' => array(
'slug' => 'suppliers/%supplier_name%/whitepapers',
)
)
);
}
I have created above post types two , I am able to get first post type correct pages and coming to 2nd post type, I am getting URL but the loads homepage content, why it is happening is there anything that i m missing to include in this both codes.suggest me i am trying since two days I have tired various methods like add_rewrite, perma_structure, need some solution on this
add flush_rewrite_rules( false ); after this register_post_type( 'straws', $args );
As i can understand you're getting wrong post link it's causing of
'rewrite' => array(
'slug' => 'suppliers/%supplier_name%/pressreleases',
)
You just need to remove both 'rewrite' parameter and SET your permalink.
My code for my form ( i am using Silex):
$test = array(
'Swedish Cars' => array(
'volvo' => 'Volvo',
'saab' => 'Saab',
),
'German Cars' => array(
'mercedes' => 'Mercedes',
'audi' => 'Audi'
)
);
$form = $app['form.factory']->createBuilder('form')
->add('title','text',array(
'attr' => array(
'placeholder' => 'Title of your Album'
)))
->add('description','textarea',array(
'attr' => array(
'placeholder' => 'Describe your Album'
)))
->add('groups', 'choice', array(
'choices' => $test,
'multiple' => true,
'attr' => array(
'data-placeholder' => 'Add your Groups ...'
),
))
The choices are defined as an multi-array, so I get <option> with <optgropup>. How can I enable in SF2, that some options are selected?
Use the data option:
->add('groups', 'choice', array(
'choices' => $test,
'multiple' => true,
'attr' => array(
'data-placeholder' => 'Add your Groups ...',
'data' => $selected_value
),
where $selected_value can be a single value like 'value_1' or an simple array with multiple values array('value_1', 'value_2') to select.
In \Zend\Validator\DateStep, I want to override the error message shown below:
protected $messageTemplates = array(
self::NOT_STEP => "The input is not a valid step"
);
I have an input filter connected to a form containing an element of the type 'Zend\Form\Element\Date' which automatically calls the DateStep validator.
Here is the relevant part of my form:
$this->add(array(
'type' => 'Zend\Form\Element\Date',
'name' => 'appointment-date',
'options' => array(
'label' => 'Appointment Date',
'format' => 'Y-m-d'
),
'attributes' => array(
'min' => date('Y-m-d'), // today's date
'max' => '2020-01-01',
'step' => '2', // days; default step interval is 1 day
)
));
Here is my input filter:
$inputFilter->add($factory->createInput(array(
'name' => 'appointment-date',
'required' => false,
'filters' => array(
array('name' => 'StripTags'),
),
'validators' => array(
array(
'name' => 'DateStep',
'options' => array(
//'step' => new DateInterval("P2D"),
//'baseValue' => new DateTime(),
'messages' => array(
\Zend\Validator\DateStep::NOT_STEP => 'Must be a day in the future',
),
),
),
),
)));
The inputFilter seems to be ignored. I tried setting up the step and baseValue in the inputFilter, but that seems to not work at all. Working app can be found here: https://github.com/bickerstoff/zf2_datetest if more details are needed.
Looks like you're trying to filter a "Date" input with a "DateStep" validator.
$this->add(array(
'type' => 'Zend\Form\Element\Date',
'name' => 'appointment-date',
'options' => array(
'label' => 'Appointment Date',
'format' => 'Y-m-d'
),
'attributes' => array(
'min' => date('Y-m-d'), // today's date
'max' => '2020-01-01',
'step' => '2', // days; default step interval is 1 day
)
));
This may cause your problem.
for example, I want to get this url string
/1/2/3/4
In view:
$this->url('routeName', array(
'a' => array(1, 2, 3, 4)
));
In controller:
print_r($this->params()->fromRoute('a'));
Output is:
array(
0 => 1,
1 => 2,
2 => 3,
3 => 4
);
Is it possible to create this route?
IF it would work at all, it'd be using the class Zend\Mvc\Router\Http\WildCard. Since I never got that one to be working the way i expected it to be though, i suggest you go the ZF2 way where you have full control over what you're doing ;) Parameters and configuration stuff should be named always! I suggest you create a simple route of type Zend\Mvc\Router\Http\Segment:
'routename' => array(
'type' => 'Zend\Mvc\Router\Http\Segment',
'options' => array(
'route' => '/:val1/:val2/:val3/:val4',
'defaults' => array(
'controller' => 'controllername',
'action' => 'actionname'
),
'constraints' => array(
'val1' => '[0-9]+',
'val2' => '[0-9]+',
'val3' => '[0-9]+',
'val4' => '[0-9]+'
)
)
)
If the requirements are different, obviously the route configuration would change. You'd need to set up the route like this:
$this->url('routename', array(
'val1' => 1,
'val2' => 2,
'val3' => 3,
'val4' => 4
));
Add the url routing in module.config.php file like this:
'routename' => array(
'type' => 'Zend\Mvc\Router\Http\Segment',
'options' => array(
'route' => 'routename[/:val1][/:val2][/:val3][/:val4]',
'defaults' => array(
'controller' => 'controllername',
'action' => 'actionname'
),
'constraints' => array(
'val1' => '[0-9]+',
'val2' => '[0-9]+',
'val3' => '[0-9]+',
'val4' => '[0-9]+'
)
)
)
And then add the number by following this:
$this->url('routename', array(
'val1' => 1,
'val2' => 2,
'val3' => 3,
'val4' => 4
));
And you can get all the parameter by :
print_r($this->params());
I do have the following form:
'region' => new sfWidgetFormChoice(array('expanded' => true,'choices' => $region))
I get the folloing html.
<ul class="radio_list">
<li> first...
<li> second....
I want to change the name of class in the table. It shouldn't be radio_list. I want to name it by my own?
How can I do it in 'region'?
Following is not working and changes the classes of <li>:
'region' => new sfWidgetFormChoice(array('expanded' => true,'choices' => $region), array('class' => 'your_class'))
Thanks!
Gunnar
This is my complete Widget:
$this->setWidgets(array(
'recipename' => new sfWidgetFormInputText(array(), array('size' => '40', 'maxlength' => '150')),
'description' => new sfWidgetFormInputText(array(), array('size' => '40', 'maxlength' => '100')),
'ingredients' => new sfWidgetFormTextarea(array(), array('rows' => '10', 'cols' => '35')),
'preparation' => new sfWidgetFormTextarea(array(), array('rows' => '10', 'cols' => '35')),
'kis' => new sfWidgetFormChoice(array('expanded' => true, 'choices' => $kis)),
'category' => new sfWidgetFormChoice(array('expanded' => true, 'choices' => $category)),
'region' => new sfWidgetFormChoice(array('expanded' => true, 'choices' => $region)),
));
You need to use renderer_options for that, since sfWidgetFormSelectRadio overrides passed attribute with it's own option.
new sfWidgetFormChoice(array(
'expanded' => true,
'choices' => $region,
'renderer_options' => array(
'class' => 'your_class'
)
);