zoukankan      html  css  js  c++  java
  • 学做十八哥的bool商城商品编辑器的调用

    <?php
    /*燕十八 公益PHP培训  
    课堂地址:YY频道88354001  
    学习社区:www.zixue.it */
    /*
    	跟着十八学做商城
    	自己在做商品添加详细描述的时候调用编辑器的方法
    	思路:
    	1:下载好编辑器包(我下的是FCKeditor);
    	2:放到一个合适的位置(自己觉得放哪合适都可以);
    	3:在需要显示编辑器的地方引入编辑器类文件,创建编辑器对象,然后生成编辑器(O啦);
    */
    
    
    
    <?php
    /*	这里是goodsadd.php
    	goodsadd.html的php引入页面
    */	
    	define('ACC',true);
    	require_once("../include/initial.php");
    	
    
    	require_once(ROOT.'/view/admin/templates/goodsadd.html');
    	//引入编辑器
    
    ?>
    
    
    <?php
    	/*
    		这里是写在goodsadd.html里面的
    	*/
    	//通过$_SERVER['PHP_SELF']找到当前路径
    	$sBasePath = $_SERVER['PHP_SELF'] ;
    	//通过substr 和 strpos 函数找到编辑器的路径,我的编辑器是放在include文件夹下的edit目录下.
    	$sBasePath = substr( $sBasePath, 0, strpos( $sBasePath, "Admin" )).'include/edit/';
    	//创建编辑器对象
    	$oFCKeditor = new FCKeditor('FCKeditor1') ;
    	//给对象默认路径赋值
    	$oFCKeditor->BasePath	= $sBasePath ;
    	//编辑器的初始值
    	$oFCKeditor->Value		= '<p>This is some <strong>sample text</strong>. You are using <a href="http://www.fckeditor.net/">FCKeditor</a>.</p>' ;
    	//生成编辑器
    	$oFCKeditor->Create() ;
    	?>	
    
    <?php
    	/*	这里是init.php
    		当	$oFCKeditor = new FCKeditor('FCKeditor1') ;new的时候,会调用init.php
    		的_autoload()方法因此需要在这里引入编辑器的类文件
    		在__autoload()方法里添加一个逻辑
    	*/
    	function __autoload($class){
    		if(substr($class,-5)=='Model'){
    			$table = substr($class,0,-5);
    			require_once (ROOT."Model/".$class.".class.php");
    		}else if($class=='FCKeditor'){
    			require_once (ROOT.'/include/edit/fckeditor.php');
    		}else{
    			require_once (ROOT."Include/".$class.".class.php");
    		}
    	}
    
    <?php
    /*
    	完成了,编辑调用成功!拿出来分享下,不足之处望指出,谢谢!
    */
    
  • 相关阅读:
    PHP基础学习笔记(一)
    安装wampserver之后,浏览器中输入localhost页面显示IIS7解决办法
    HTML5常识总结(一)
    AngularJs中的服务
    AngularJs中的directives(指令part1)
    Happy Number——LeetCode
    Binary Tree Zigzag Level Order Traversal——LeetCode
    Construct Binary Tree from Preorder and Inorder Traversal——LeetCode
    Construct Binary Tree from Inorder and Postorder Traversal——LeetCode
    Convert Sorted Array to Binary Search Tree——LeetCode
  • 原文地址:https://www.cnblogs.com/luowen/p/2795948.html
Copyright © 2011-2022 走看看