I realize this should be easy but, for some reason, the solution eludes me.
I am trying to using the submit content extension. I would like to add some text to the $fulltext which is being saved to the article. That text needs to include the full path to an uploaded file.
The upload and form are working fine. The article is created fine. I just can't seem to get to the full path of the uploaded file into my article content. I have searched through the forums and I have seen very similar discussions but none of those solutions seem to work.
Here is the excerpt from my OnSubmit (after email) code (but I have emails turned off...don't need them).
I am trying to using the submit content extension. I would like to add some text to the $fulltext which is being saved to the article. That text needs to include the full path to an uploaded file.
The upload and form are working fine. The article is created fine. I just can't seem to get to the full path of the uploaded file into my article content. I have searched through the forums and I have seen very similar discussions but none of those solutions seem to work.
Here is the excerpt from my OnSubmit (after email) code (but I have emails turned off...don't need them).
$fulltext_template = "{desc}<br />
{pdf={file}#scrollbar=1&toolbar=0&navpanes=0|750|650}";
$fulltext_template = str_replace("{desc}",''.JRequest::getVar("fulltext").'', $fulltext_template);
JRequest::setVar('longfile', 'http://www.xxx.com/upload/resumes/'.str_replace(JPATH_SITE, '', $attachments['resume']));
$fulltext_template = str_replace("{file}",''.JRequest::getVar("longfile").'', $fulltext_template);
JRequest::setVar("fulltext", $fulltext_template);
I thought that the $attachments array was not generated unless email was sent. So I enabled attachments. I am now receiving attachments but the code is not working. Has to be something stupid.
Also, once we get this working, I really don't need email sent. How can I get access to the full path of the file without going through $attachments?
Also, once we get this working, I really don't need email sent. How can I get access to the full path of the file without going through $attachments?
Problem solved. A little sleep and a clean slate does wonders.
BTW, this component is unbelievable. Definitely purchasing a license.
Here is the code in case it could help someone in the future:
BTW, this component is unbelievable. Definitely purchasing a license.
Here is the code in case it could help someone in the future:
<?php
$_POST['catid'];
$_POST['id'] = '';
$_POST['sectionid'] = '21';
$_POST['state'] = '1';
$_POST['created'] = date("Y-m-d H:i:s");
$user = &JFactory::getUser();
$_POST['created_by'] = $user->id;
$longfile = '{pdf=/upload/resumes/'.JRequest::getVar("resume").'#scrollbar=1&toolbar=0&navpanes=0|750|650}';
$fulltext_template = "{desc}<br /><br />{file}<p> </p>{module feedback_ads}<p> </p><p> </p>";
$fulltext_template = str_replace("{desc}",''.JRequest::getVar("fulltext").'', $fulltext_template);
$fulltext_template = str_replace("{file}",$longfile, $fulltext_template);
JRequest::setVar("fulltext", $fulltext_template);
?>
This topic is locked and no more replies can be posted.