Jump to content
Pardon our ads (a necessary update) ×

CK Editor and PHP code


bullbreed

Recommended Posts

Hi guys. Not sure if this is in the right place.

 

Have any of you had any dealings with CK Editor? I know it's a new version of FCK Editor but here is the problem.

I have used it as an HTML editor in my CMS but I want to add a little php code in the source view of the editor but the editor doesn't run the script.

 

My Navigation and page content is driven from the database (e.g. index.php?pid=1)

So because there is only one page to my site I think i have to add all php into the CK editor because I don't know how to insert my own pages in between the dynamically generated pages.

 

Whats your advice guys

Link to comment
https://forums.phpfreaks.com/topic/193468-ck-editor-and-php-code/
Share on other sites

php is a server side scripting language. I'm not sure what you are trying to do, but the editor you are using and all the other web based 'content' editors are client-side browser applications. They simply submit data to the server.

Oh I see. Thats not quite what I wanted.

 

You see the whole site currently runs off the index.php page, so the About Us page might be index.php?pid-2

This is so admin can add any page they wish in the cms.

The site navigation is generated from the database when the admin adds a page.

 

I would need to be able to add a page in the navigation but as its generated from the database i dont know how.

 

Here is the code for the navigation

<?php require_once('Connections/dbconnect.php'); ?>

<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}


$query_menu = "SELECT * FROM webpages ORDER BY page_order ASC";
$menu = mysql_query($query_menu) or die(mysql_error());
$row_webpages = mysql_fetch_assoc($menu);
$totalRows_menu = mysql_num_rows($menu);
?>

<div id="topmenu">
<ul>
    	<?php do { ?>
    	  <li><a href="index.php?pid=<?php echo $row_webpages['pid']; ?>"><?php echo $row_webpages['page_name']; ?></a></li>
          
    	 <?php } while ($row_webpages = mysql_fetch_assoc($menu)); ?>
         <li><a href="products.php">Products</a></li>
    </ul>
</div>
<?php
mysql_free_result($menu);
?>

 

In the example above I added a products.php page  but this will always appear at the end of the navigation list as the current nav is called as a array

 

How could I add the products.php page as a stand alone page in the middle of the nav array if that makes sense.

Like this HOME    ABOUT US    PRODUCTS    CONTACT

where Home - About and Contact is generated from the code above?

Archived

This topic is now archived and is closed to further replies.



×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.