Results 1 to 5 of 5

Thread: use alias and enclosure from frontend

  1. #1
    New user
    Join Date
    01-13-10.
    Posts
    6

    Default use alias and enclosure from frontend

    Hi,

    I'm trying to create something for a web based application thaht needs to insert new records in the tl_news table of contao from a front-end form.

    Before coding the form, I have tested manually how to insert a new record using phpmyadmin. I have some errors with the alias and enclosure fields.

    how can I create a new record in that table from frontend ? Is there some functions to generate automatically value for that fields ?

    Thanks in advance for your helps.

  2. #2
    User
    Join Date
    06-19-09.
    Posts
    328

    Default Re: use alias and enclosure from frontend

    post the errors
    Consulenza Contao CMS https://www.intco.it

  3. #3
    New user
    Join Date
    01-13-10.
    Posts
    6

    Default Re: use alias and enclosure from frontend

    Here are the logs from phpmyadmin:

    Code:
    requête SQL: Modifier
    
    INSERT INTO `contao`.`tl_news` (
    `id` ,
    `pid` ,
    `tstamp` ,
    `headline` ,
    `alias` ,
    `author` ,
    `date` ,
    `time` ,
    `subheadline` ,
    `teaser` ,
    `text` ,
    `addImage` ,
    `singleSRC` ,
    `alt` ,
    `size` ,
    `imagemargin` ,
    `imageUrl` ,
    `fullsize` ,
    `caption` ,
    `floating` ,
    `addEnclosure` ,
    `enclosure` ,
    `source` ,
    `jumpTo` ,
    `articleId` ,
    `url` ,
    `target` ,
    `cssClass` ,
    `noComments` ,
    `featured` ,
    `published` ,
    `start` ,
    `stop`
    )
    VALUES (
    NULL , '8', '0', '', UNHEX( '' ) , '2', '0', '0', '', NULL , NULL , '', '', '', '', '', '', '', '', '', '', UNHEX( ) , 'default', '0', '0', '', '', '', '', '', '1', '', ''
    )
    
    MySQL a répondu:Documentation
    #1582 - Incorrect parameter count in the call to native function 'UNHEX'

  4. #4
    User
    Join Date
    06-19-09.
    Posts
    328

    Default Re: use alias and enclosure from frontend

    the problem is related to phpmyadmin that doesn't check the input you provide

    it has nothing to do with the alias and enclosure fields.

    however:

    you can create the alias with the following code

    Code:
    $alias = standardize($newsTitle);
    where "standardize" is a function provided by Contao and $newsTitle is the value of the news title coming from your form.

    enclosure should contain a serialize()'d array of files path e.g.

    Code:
    $arrAttachment = array('tl_files/path/to/file1', 'tl_files/path/to/file2');
    
    $enclosure        = serialize($arrAttachment);
    please note that if you need to show attachment using standard news frontend modules you *must* set the addEnclosure field to 1
    Consulenza Contao CMS https://www.intco.it

  5. #5
    New user
    Join Date
    01-13-10.
    Posts
    6

    Default Re: use alias and enclosure from frontend

    thanks for your helps

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •