添加到zend框架时,jwysiwyg editer无法正常工作

时间:2011-05-19 05:05:03

标签: jquery zend-framework

  

jwysiwyg

我的zend应用程序的文本编辑器,我在我的phtml中给了编辑器的路径,它没有加载文本编辑器的图像,只显示为链接,

这是我的phtml。

<?php
if ($this->errors) {

    echo "<div class='error'><ul>";

    foreach ($this->errors as $key => $value) {
        foreach($value as $l => $msg){
            echo '<li>' . $msg . '</li>';
        }
    }

    echo "</ul></div>";
}
$registry = Zend_Registry::get("cacheserver");
$formdata = $this->formdata;

?>

<script type="text/javascript" src="<?php echo $registry->tinymceurl ; ?>jquery.wysiwyg.js"></script>
<script language="javascript" type="text/javascript">   

    var baseUrl = "<?php echo $this->baseUrl(); ?>";
    var divtwodata = "<?php echo $this->divtwodata ; ?>";

    $(document).ready(function(){
        if(!divtwodata) {
            $('#divtwo').hide();
        }
        else {
            $('#divone').hide();
        }

        $("#back").live('click',function() {
            $('#divtwo').hide();
            $('#divone').show();
        });


        $('#save').live('click',function() {

            var invoice_no = $('#invoiceno').val();
            var payer_name = $('#payername').val();
            var amount = $('#amount').val();
            var payer_email = $('#email').val();
            //var email_subject = $('#').val();
            var email_body = $('#body').html();
            var property_id = $("#hotels option:selected").val();
            var property_name = $("#hotels option:selected").text();

            $.ajax({
                type: "POST",                       
                url: baseUrl + '/admin/customerinvoice/addcustomerinvoice',
                data: {
                        invoice_no:invoice_no,
                        payer_name:payer_name,
                        amount:amount,
                        payer_email:payer_email,
                        email_body:email_body,
                        property_id:property_id
                      },
                async: false,                     
                success: function(data){                        
                    if(data){                                   
                        //error_list += '<li>Room type name already used. Try another name</li>';
                        //error = true;
                        alert("true");
                    }
                    else{
                        alert("false");
                    }
                }
            });     
        });

         $('.tinymce').wysiwyg({

                css: '<?php echo $registry->tinymceurl ; ?>jquery.wysiwyg.css' ,    
                icon: '<?php echo $registry->tinymceurl ; ?>jquery.wysiwyg.gif' ,    

                controls: {
                strikeThrough: { visible: true },
                underline: { visible: true },
                subscript: { visible: true },
                superscript: { visible: true }
            }                    
         });            

    });
</script>

<?php

echo '<div id="divone"><div id="divHeader">
            <div class="floatleft">
                <h3>Add Customer invoice</h3>       
            </div>
            <div class="clear"></div>
        </div>
        <fieldset class="coloredfield"><div class="box275">';

echo $this->form ;

echo '</div></fieldset></div>';

?>

<div id="divtwo">
<table class="wid100">
    <thead>
        <tr class="header">
            <th></th>
            <th></th>
        </tr>
    </thead>
    <tbody>
        <tr class="even">
            <td class="textalignleft wid30"><strong>Invoice number :</strong></td>
            <td class="textalignright wid65"><?php echo $formdata['invoice']; ?></td>
        </tr>
        <tr class="even">
            <td class="textalignleft wid30"><strong>Payer name :</strong></td>
            <td class="textalignleft wid65"><?php echo $formdata['payer']; ?></td>
        </tr>
        <tr class="even">
            <td class="textalignleft wid30"><strong>Amount :</strong></td>
            <td class="textalignright wid65"><?php echo $formdata['amount']; ?></td>
        </tr>
        <tr class="even">
            <td class="textalignleft wid30"><strong>payer Email :</strong></td>
            <td class="textalignleft wid65"><?php echo $formdata['email'] ?></td>
        </tr>
        <tr class="even">
            <td class="textalignleft wid30"><strong>Email subject :</strong></td>
            <td class="textalignleft wid65"><?php echo $formdata['subject'] ?></td>
        </tr>
        <tr class="even">
            <td class="textalignleft wid30"><strong>Email body :</strong></td>
            <td class="textalignleft wid65"><?php echo $formdata['body'] ?></td>
        </tr>
    </tbody>
</table>

<div class="w135 floatright margin-top20">
<div class="floatright"><a href="#" id="back" class="linkbutton">Back</a></div>
<div class="floatleft"><a href="#" id="save" class="linkbutton">save</a></div>
</div>

</div>

这是我的cacheserver.ini

![production]
cacheserver.url = "http://localhost:4000/jetwing-ibestatic/public/"
cacheserver.tinymceurl  ="http://localhost:4000/jetwing-ibestatic/public/js/jwysiwyg/"

cacheserver.js.path = "js"
cacheserver.style.path = "css"

cacheserver.js.files[] = "jquery-1.4.4.min.js"
cacheserver.js.files[] = "jquery-ui-1.8.6.custom.min.js"
cacheserver.js.files[] = "jquery.emeCalendar.js"
cacheserver.js.files[] = "jquery.emeDataProcessor.js"
cacheserver.js.files[] = "jquery.emeSearchValidator.js"
cacheserver.js.files[] = "jquery.emeValidator.js" 
cacheserver.js.files[] = "json2.min.js"

cacheserver.style.files[] = "ie6.css"
cacheserver.style.files[] = "ie7.css"
cacheserver.style.files[] = "jquery-ui-1.8.6.custom.css"
cacheserver.style.files[] = "styles.css"

cacheserver.admin.js.files[] = "jquery-1.4.4.min.js"
cacheserver.admin.js.files[] = "jquery-ui-1.8.6.custom.min.js"
cacheserver.admin.js.files[] = "jquery.emeCalendar.js"
cacheserver.admin.js.files[] = "jquery.emeActivator.js"
cacheserver.admin.js.files[] = "scripts.js"
cacheserver.admin.js.files[] = "jquery.validate.js"
cacheserver.admin.js.files[] = "jquery.livequery.js"
cacheserver.admin.js.files[] = "jquery.form.js"


cacheserver.admin.style.files[] = "styles.css"
cacheserver.admin.style.files[] = "jquery-ui-1.8.6.custom.css"
cacheserver.admin.style.files[] = "admin-custom.css"

cacheserver.images.path = APPLICATION_PATH "/../images";

[staging : production]

[testing : production]

[development : production][1]

我确信我给出了正确的路径,我有一个带有类似tinymce的textarea,请帮助我。

enter image description here

1 个答案:

答案 0 :(得分:1)

我之前从未使用过此编辑器。

查看您的代码和

https://github.com/akzhan/jwysiwyg

http://akzhan.github.com/jwysiwyg/help/examples/02-full.html

我觉得css没有加载。一个

css: '<?php echo $registry->tinymceurl ; ?>jquery.wysiwyg.css'

你正在尝试的只是针对内部内容。

要使文本编辑器应用css,必须加载它。请参阅示例和源代码。因为我没有看到你的观点来源,所以我也不能多说。

希望有助于追踪它。