Hi people,
im Piter and i need a help for my work.
I have created a form with:
- hide label (id of article)
- hide label (id of categories)
- upload image
- textarea (for description of the image)- [textarea_2]
In the events i have
- upload image
- image resize
- custom code
- db save assigned to the Jos_content table
In the custom code i have put inside
EVERYTHING WORK WHEN I SUBMIT AND THE ARTICLE IS CHANGED WHIT THE CONTENT I HAVE SUBMITTED
MY QUESTION IS
If i want only to add to article something and not replace every time the content
what i have to do?
I HAVE TRY WITH ADD THIS IN THE CUSTOM CODE:
BUT DON'T WORK - IN THE ARTICLE I CAN SEE ONLY THE FILE NAME OF THE IMAGE.
PLEASE I NEED HELP🙂
im Piter and i need a help for my work.
I have created a form with:
- hide label (id of article)
- hide label (id of categories)
- upload image
- textarea (for description of the image)- [textarea_2]
In the events i have
- upload image
- image resize
- custom code
- db save assigned to the Jos_content table
In the custom code i have put inside
<?php
jimport( 'joomla.filesystem.file' );
$small_image = $form->data['introtext'];
$ext = JFile::getExt($small_image);
$name = JFile::stripExt($small_image);
$name = 'big_'.$name.'_big.'.$ext;
$uri = JFactory::getURI();
$img_tag = "<table border='0' cellpadding='1' cellspacing='1' style='width: 500px;'><tbody><tr><td><a class='jcepopup' href='{$uri->root()}images/stories/{$name}'><img width='200px'; height='auto' src='{$uri->root()}images/stories/{$name}' style='float:left;' ; hspace='5px'/></a>";
// add the image to the introtext
$form->data['introtext'] = $img_tag.$form->data['textarea_2'];
?>
<?php
$form->data['introtext'] = "{$form->data['introtext']}</td></tr></tbody></table>";
?>
EVERYTHING WORK WHEN I SUBMIT AND THE ARTICLE IS CHANGED WHIT THE CONTENT I HAVE SUBMITTED
MY QUESTION IS
If i want only to add to article something and not replace every time the content
what i have to do?
I HAVE TRY WITH ADD THIS IN THE CUSTOM CODE:
<?php
jimport( 'joomla.filesystem.file' );
$small_image = $form->data['introtext'];
$ext = JFile::getExt($small_image);
$name = JFile::stripExt($small_image);
$name = 'big_'.$name.'_big.'.$ext;
$uri = JFactory::getURI();
$img_tag = "<table border='0' cellpadding='1' cellspacing='1' style='width: 500px;'><tbody><tr><td><a class='jcepopup' href='{$uri->root()}images/stories/{$name}'><img width='200px'; height='auto' src='{$uri->root()}images/stories/{$name}' style='float:left;' ; hspace='5px'/></a>";
// add the image to the introtext
$form->data['introtext'] = $img_tag.$form->data['textarea_2'];
?>
<?php
$form->data['introtext'] = "{$form->data['introtext']}</td></tr></tbody></table>";
$query = "
UPDATE `#__content`
SET `fulltext` = '{$img_tag}'
WHERE `id` = {290};
";
$db->setQuery($query);
$db->query();
?>
BUT DON'T WORK - IN THE ARTICLE I CAN SEE ONLY THE FILE NAME OF THE IMAGE.
PLEASE I NEED HELP🙂