Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8861025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:23:53+00:00 2026-06-14T15:23:53+00:00

I added additional editor field in Joomla 1.5 administrator panel: $editor =& JFactory::getEditor(); echo

  • 0

I added additional editor field in Joomla 1.5 administrator panel:

$editor =& JFactory::getEditor();
echo $editor->display( 'shortdescr',  $row->shortdescr , '100%', '150', '75', '20', false );

All works fine, but when I try to save html in this field joomla remove html-tags and I get only plain text.

here my saveContent function:

function saveContent()
{
    global $mainframe;
    // Check for request forgeries
    JRequest::checkToken() or jexit( 'Invalid Token' );

    // Initialize variables
    $db     = & JFactory::getDBO();
    $user       = & JFactory::getUser();
    $dispatcher     = & JDispatcher::getInstance();
    JPluginHelper::importPlugin('content');

    $details    = JRequest::getVar( 'details', array(), 'post', 'array');
    $option     = JRequest::getCmd( 'option' );
    $task       = JRequest::getCmd( 'task' );
    $sectionid  = JRequest::getVar( 'sectionid', 0, '', 'int' );
    $redirect   = JRequest::getVar( 'redirect', $sectionid, 'post', 'int' );
    $menu       = JRequest::getVar( 'menu', 'mainmenu', 'post', 'menutype' );
    $menuid     = JRequest::getVar( 'menuid', 0, 'post', 'int' );
    $nullDate   = $db->getNullDate();

    $row = & JTable::getInstance('content');
    if (!$row->bind(JRequest::get('post'))) {
        JError::raiseError( 500, $db->stderr() );
        return false;
    }
    $post=JRequest::get('post');
    $post['shortdescr'] = JRequest::getVar( 'shortdescr', '', 'post', 'string', JREQUEST_ALLOWHTML );
    $row->bind($details);

    // sanitise id field
    $row->id = (int) $row->id;

    $isNew = true;
    // Are we saving from an item edit?
    if ($row->id) {
        $isNew = false;
        $datenow =& JFactory::getDate();
        $row->modified      = $datenow->toMySQL();
        $row->modified_by   = $user->get('id');
    }

    $row->created_by    = $row->created_by ? $row->created_by : $user->get('id');

    if ($row->created && strlen(trim( $row->created )) <= 10) {
        $row->created   .= ' 00:00:00';
    }

    $config =& JFactory::getConfig();
    $tzoffset = $config->getValue('config.offset');
    $date =& JFactory::getDate($row->created, $tzoffset);
    $row->created = $date->toMySQL();

    // Append time if not added to publish date
    if (strlen(trim($row->publish_up)) <= 10) {
        $row->publish_up .= ' 00:00:00';
    }

    $date =& JFactory::getDate($row->publish_up, $tzoffset);
    $row->publish_up = $date->toMySQL();

    // Handle never unpublish date
    if (trim($row->publish_down) == JText::_('Never') || trim( $row->publish_down ) == '')
    {
        $row->publish_down = $nullDate;
    }
    else
    {
        if (strlen(trim( $row->publish_down )) <= 10) {
            $row->publish_down .= ' 00:00:00';
        }
        $date =& JFactory::getDate($row->publish_down, $tzoffset);
        $row->publish_down = $date->toMySQL();
    }

    // Get a state and parameter variables from the request
    $row->state = JRequest::getVar( 'state', 0, '', 'int' );
    $params     = JRequest::getVar( 'params', null, 'post', 'array' );

    // Build parameter INI string
    if (is_array($params))
    {
        $txt = array ();
        foreach ($params as $k => $v) {
            $txt[] = "$k=$v";
        }
        $row->attribs = implode("\n", $txt);
    }

    // Get metadata string
    $metadata = JRequest::getVar( 'meta', null, 'post', 'array');
    if (is_array($metadata))
    {
        $txt = array();
        foreach ($metadata as $k => $v) {
            if ($k == 'description') {
                $row->metadesc = $v;
            } elseif ($k == 'keywords') {
                $row->metakey = $v;
            } else {
                $txt[] = "$k=$v";
            }
        }
        $row->metadata = implode("\n", $txt);
    }

    // Prepare the content for saving to the database
    ContentHelper::saveContentPrep( $row );

    // Make sure the data is valid
    if (!$row->check()) {
        JError::raiseError( 500, $db->stderr() );
        return false;
    }

    // Increment the content version number
    $row->version++;

    $result = $dispatcher->trigger('onBeforeContentSave', array(&$row, $isNew));
    if(in_array(false, $result, true)) {
        JError::raiseError(500, $row->getError());
        return false;
    }

    // Store the content to the database
    if (!$row->store()) {
        JError::raiseError( 500, $db->stderr() );
        return false;
    }

    // Check the article and update item order
    $row->checkin();
    $row->reorder('catid = '.(int) $row->catid.' AND state >= 0');

    /*
     * We need to update frontpage status for the article.
     *
     * First we include the frontpage table and instantiate an instance of it.
     */
    require_once (JPATH_ADMINISTRATOR.DS.'components'.DS.'com_frontpage'.DS.'tables'.DS.'frontpage.php');
    $fp = new TableFrontPage($db);

    // Is the article viewable on the frontpage?
    if (JRequest::getVar( 'frontpage', 0, '', 'int' ))
    {
        // Is the item already viewable on the frontpage?
        if (!$fp->load($row->id))
        {
            // Insert the new entry
            $query = 'INSERT INTO #__content_frontpage' .
                    ' VALUES ( '. (int) $row->id .', 1 )';
            $db->setQuery($query);
            if (!$db->query())
            {
                JError::raiseError( 500, $db->stderr() );
                return false;
            }
            $fp->ordering = 1;
        }
    }
    else
    {
        // Delete the item from frontpage if it exists
        if (!$fp->delete($row->id)) {
            $msg .= $fp->stderr();
        }
        $fp->ordering = 0;
    }
    $fp->reorder();

    $cache = & JFactory::getCache('com_content');
    $cache->clean();

    $dispatcher->trigger('onAfterContentSave', array(&$row, $isNew));

    switch ($task)
    {
        case 'go2menu' :
            $mainframe->redirect('index.php?option=com_menus&menutype=' . $menu);
            break;

        case 'go2menuitem' :
            $mainframe->redirect(
                'index.php?option=com_menus&menutype=' . $menu
                . '&task=edit&id=' . $menuid
            );
            break;

        case 'menulink' :
            ContentHelper::menuLink($redirect, $row->id);
            break;

        case 'resethits' :
            ContentHelper::resetHits($redirect, $row->id);
            break;

        case 'apply' :
            $msg = JText::sprintf('SUCCESSFULLY SAVED CHANGES TO ARTICLE', $row->title);
            $mainframe->redirect('index.php?option=com_content&sectionid='.$redirect.'&task=edit&cid[]='.$row->id, $msg);
            break;

        case 'save' :
        default :
            $msg = JText::sprintf('Successfully Saved Article', $row->title);
            $mainframe->redirect('index.php?option=com_content&sectionid='.$redirect, $msg);
            break;
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T15:23:54+00:00Added an answer on June 14, 2026 at 3:23 pm

    Instead of this-

    $row = & JTable::getInstance('content');
    if (!$row->bind(JRequest::get('post'))) {
        JError::raiseError( 500, $db->stderr() );
        return false;
    }
    $post=JRequest::get('post');
    $post['shortdescr'] = JRequest::getVar( 'shortdescr', '', 'post', 'string', JREQUEST_ALLOWHTML );
    

    try this-

        $post=JRequest::get('post');
        $post['shortdescr'] = JRequest::getVar( 'shortdescr', '', 'post', 'string', JREQUEST_ALLOWHTML );
        $row = & JTable::getInstance('content');
        if (!$row->bind($post)) {
            JError::raiseError( 500, $db->stderr() );
            return false;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need some additional functionality added to user_pass_submit. This must be added without changing
i have added an additional admin user and created a role for it, allowing
I have added 3 additional languages (fr, es-mx, de) to English in my company's
Hey everyone, I am expanding my team and I have recently added an additional
In Eclipse, Run Configurations, I added additional emulator command line option -tcpdump emulator1.cap and
I added an additional, new DataSet to my report and have been getting this
I have added one additional style to a Google Map, following Google's instructions .
Added more details at the bottom of the question. We are testing deployment scenarios
I added to my system-wide /etc/security/limits.conf the following two rows: * soft rtprio 55
I added Jquery toggle/show hide in my site (click the plus sign) http://pligg.marsgibson.info if

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.