0

i want to add DataTable javascript lib to my Zendframe work project.So is that possible to add external data lib to ZendFrame work? and how can i add DataTable lib to my zend project?

view.phtml

   <script type="text/javascript">
    var baseUrl = "<?php echo $this->baseUrl(); ?>";
    $(document).ready(function(){
        $('.jbutton').button();
    });
    $(document).ready(function() {
        $('#example').dataTable();
    } );
</script>
<span id="edit-doctor" class="jbutton floatright marr5">
    <a href="<?php
echo $this->url(
        array(
    'controller' => 'patients',
    'action' => 'edit',
    'id' => $this->patientId
        ), 'default', true
);
?>">Edit Patient</a>
</span>
<div class="clear"></div>
<?php $user = $this->user; ?>
<h1 class="title"><?php echo $user['name']; ?></h1>
<div class="underling-green"></div>
<div class="profile">
    <div class="p-image">
        <img src="<?php echo $this->baseUrl() . '/images/users/' . $user['image']; ?>"/>
    </div>
    <div class="category mart50">
        <div class="sub-title">Personal Details</div>   
        <table>
            <tbody>
                <tr>
                    <td class="p-title">Email</td>
                    <td class="p-body">
                        <span class="p-seperate">:</span> 
                        <?php echo $user['email']; ?>
                    </td>
                </tr>
                <tr>
                    <td class="p-title">Birth Day</td>
                    <td class="p-body">
                        <span class="p-seperate">:</span>
                        <?php echo $user['bday']; ?>
                    </td>
                </tr>
                <tr>
                    <td class="p-title">Telephone</td>
                    <td class="p-body">
                        <span class="p-seperate">:</span>
                        <?php echo $user['telno']; ?>
                    </td>
                </tr>  
                <tr>
                    <td class="p-title">Address</td>
                    <td class="p-body">
                        <span class="p-seperate">:</span>
                        <?php echo $user['address']; ?>                       
                    </td>
                </tr>  
            </tbody>
        </table>      
        <table id="example">
            <thead>
                <tr>
                    <th>Column 1</th>
                    <th>Column 2</th>
                    <th>etc</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>Row 1 Data 1</td>
                    <td>Row 1 Data 2</td>
                    <td>etc</td>
                </tr>
                <tr>
                    <td>Row 2 Data 1</td>
                    <td>Row 2 Data 2</td>
                    <td>etc</td>
                </tr>
            </tbody>
        </table>
    </div>
</div>
<div class="clear"></div>

i want to make "example" table preview as DataTalbe how can i do it?

2
  • What have you tried so far? Post the code you are having issues with, we don't do tutorials here, but we'll help with specific coding problems. Commented Aug 11, 2011 at 12:46
  • i can't understand boundary of tutorials and help coding problem. any way thanks ask for my codding i'll attach with my question Commented Aug 12, 2011 at 8:05

1 Answer 1

1

Just put the lib and jQuery or any other required js libs in .e.g. public/js and then in your layout.phtml (in head section) you do as follows:

$this->headScript()->prependFile($this->baseUrl('/js/jquery-version.js'));
$this->headScript()->appendFile($this->baseUrl('/js/datatableLib.js'));

echo $this->headScript();
Sign up to request clarification or add additional context in comments.

2 Comments

@user881703. This should added to head section in your layout.phtml.
@Marchin there is no head tag in my layout.phtml. may in somewhere but i new to zendframe work. so can u tell where put this code

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.