unnati
unnati

Reputation: 65

how to display page using tinymce from database

i am learning a zend framework.i am using tinymce editor for displaying dynamic content on website.now i want to display page in which header and footer comes from layout and layout content comes from database table named cms..my whole page content is stored in database..header and footer page i included in layout.phtml.i dont know how to display that with layout my layout page is as below:

<?php echo $this->doctype() ?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />


          <link rel="stylesheet" type="text/css" href="<?php echo CSS_PATH.'/jquery.jqplot.min.css';?>" />



             <script src="<?php echo CSS_JS.'/jquery.ui.widget.mn.min.js';?>" type="text/javascript"></script>
             <script src="<?php echo CSS_JS.'/jquery.effects.corin.js';?>" type="text/javascript"></script>
             <script src="<?php echo CSS_JS.'/jquery.ui.accordioe.min.js';?>" type="text/javascript"></script>
             <script src="<?php echo CSS_JS.'/jquery.effects.slide.min.js';?>" type="text/javascript"></script>

        <script language="javascript" type="text/javascript" src="<?php echo CSS_JS.'/jqPlot/jquery.jqplot.min.js';?>"></script>
        <script language="javascript" type="text/javascript" src="<?php echo CSS_JS.'/jqPlot/plugins/jqplot.barRenderer.min.js';?>"></script>
        <script language="javascript" type="text/javascript" src="<?php echo CSS_JS.'/jqPlot/plugins/jqplot.pieRenderer.min.js';?>"></script>
        <script language="javascript" type="text/javascript" src="<?php echo CSS_JS.'/jqPlot/plugins/jqplot.categoryAxisRenderer.min.js';?>"></script>
        <script language="javascript" type="text/javascript" src="<?php echo CSS_JS.'/jqPlot/plugins/jqplot.highlighter.min.js';?>"></script>
        <script language="javascript" type="text/javascript" src="<?php echo CSS_JS.'/jqPlot/plugins/jqplot.pointLabels.min.js';?>"></script>

        <script src="<?php echo CSS_JS.'/setup.js';?>" type="text/javascript"></script>
        <script type="text/javascript">

        $(document).ready(function () {
            setupDashboardChart('chart1');
            setupLeftMenu();
            setSidebarHeight();

        });
    </script>
</head>
<body>

</div>

  <?php echo $this->render('header.phtml') ?>
<?php echo $this->layout()->content ?>
 <?php echo $this->render('footer.phtml') ?> 
</body>
</html>

and also when i echo content from database it display php code as it...please help

Upvotes: 0

Views: 1851

Answers (1)

Janis Peisenieks
Janis Peisenieks

Reputation: 4998

The way you do this, is:

  1. Create the <textarea> element in your view (actionName.phtml)
  2. Echo the value of your cms entry into the <textarea> in the view
  3. Do any tinymce initialization in your layout.

These are the general steps to make it work.

Also, if I gather correctly, are you trying to keep PHP code in your DB? That is HIGHLY frowned upon, and should not be done, because for the code to be processed, it needs to be run through the eval function, which just opens your site up wide to all sorts of bad behavior.

Upvotes: 1

Related Questions