<script type="text/javascript">
    $(document).ready(function() {
        // validate the comment form when it is submitted
        
        // validate signup form on keyup and submit
        
        
        
        $("#frmUsers").validate({
            rules: {
                txtUrl: {
                    required: true
                },
                txtTitle: {
                    required: true
                },
                txtKeyword: {
                    required: true
                },
                txtDescription: {
                    required: true
                }
                
            },
            messages: {
                txtUrl: {
                    required: "Please enter URL"
                },
                txtTitle: {
                    required: "Please enter title"
                },
                txtKeyword: {
                    required: "Please enter keyword"
                    
                },
                txtDescription: {
                    required: "Please enter Description"
                }
                
            }
        });
        
    });
    
    
</script>
<div class="comm_content_block">
    <h3>Manage Settings</h3>
    <div class="admin_tab_container">
        <div class="admin_tab_menu">
            <ul>
                <li><a href="<?php echo ConfigUrl::base(); ?>index/settings" >General Settings</a></li>
                <?php if (SITE_PAYMENT_MODE == "paid") { ?>
                    <li><a href="<?php echo ConfigUrl::base(); ?>index/paymentsettings">Payment Settings</a></li>
                <?php } ?>
                <li><a href="<?php echo ConfigUrl::base(); ?>index/formfields"> Manage Form Fields</a></li>
                <li><a href="<?php echo ConfigUrl::base(); ?>index/metatag" class="selected"> Manage Meta-tags</a></li>
            </ul>
            <div class="clear"></div>
        </div>
        <div class="admin_tab_contents">
            <!-- Category Listing -->
            <?php if ($this->act == "edit" || $this->act == "add") { ?>
                <?php
                if ($this->act == "edit") {

                    $user = 'Edit Meta-tag';
                } else {

                    $user = 'Add Meta-tag';
                }
                ?>
                <!--<div class="comm_div">
                <div class="comm_content_block">
                    <h3><?php echo $user ?></h3>
                        
                </div>
            </div>-->
                
                <div  style="color:green;" ><?php echo $this->message; ?></div>
                    
                <form name="frmUsers" id="frmUsers" method="post" action="">
                    <input type="hidden" value="<?php echo $this->id; ?>" name="id"/>
                    <input type="hidden" value="<?php echo ($this->act == "edit") ? 'edit' : 'add' ?>" name="act"/>
                        
                    <table border="0" cellpadding="0" cellspacing="0" class="form_tbls"  width="100%">
                        <tr>
                            <td colspan="2"><div style="padding:7px; border:1px solid #cfcfcf; border-radius:5px; -webkit-border-radius:5px; color:#666666; line-height:25px; -moz-border-radius:5px;">Url combinations can be : <br>[1] /abc/ [exact location abc after your domain name] eg : www.domainname.com/abc/ ,<br>[2] /abc/*  [any combination after location abc after your domain name] eg : www.domainname.com/abc/test1,<br>[3] *[default value] </td>
                                    </tr>
                                    <tr>
                                        <th valign="center">URL<span style="color: red">*</span> : </th>
                                        <td><input type="text" class="txt_area" id="txtUrl"  name="txtUrl" value="<?php echo stripslashes($this->resTags->url); ?>"/>
                                        </td>
                                    </tr>
                                        
                                    <tr>
                                        <th valign="center">Meta Title<span style="color: red">*</span> : </th>
                                        <td><input type="text"  class="txt_area" id="txtTitle"  name="txtTitle" value="<?php echo stripslashes($this->resTags->title); ?>"/></td>
                                    </tr>
                                    <tr>
                                        <th valign="center">Meta Keywords<span style="color: red">*</span> :</th>
                                        <td><input type="text" class="txt_area" id="txtKeyword" name="txtKeyword" value="<?php echo stripslashes($this->resTags->keyword); ?>"/></td>
                                            
                                    </tr>
                                    <tr>
                                        <th valign="center"> Meta Description<span style="color: red">*</span> :</th>
                                        <td><input type="text" class="txt_area" id="txtDescription" name="txtDescription" value="<?php echo stripslashes($this->resTags->description); ?>"/></td>
                                            
                                    </tr>
                                        
                                    <tr>
                                        <th>&nbsp;</th>
                                        <td valign="top">
                                            <input type="button"  value="Back" name="submit" class="btn_styles" onclick="window.location ='<?php echo ConfigUrl::base() ?>index/metatag'"/>
                                            <input type="submit"  value="<?php echo ($this->act == "add") ? 'Add' : 'Update' ?>" name="btnTag" class="btn_styles"/>
                                                
                                        </td>
                                    </tr>
                    </table>
                    <input type="hidden" value="hidden" name="hidInput" />
                </form>
    <?php
} else {
    ?>
                <div class="comm_div">
                    <div >
                        
                        
                        
                        <div  style="color:red;font-size: 15px " ><?php echo $this->message; ?></div>
                        <div>
                            
                            
                            <table width="99%">
                                <tbody><tr>
                                        <td width="64%" align="right">
                                            <div style="padding:5px 0;">
                                                <a href="<?php echo ConfigUrl::base() ?>index/metatag?act=add" class="btn_styles" style="text-decoration: none; display:block; float:right;">Add Metatag</a>
                                            </div>
                                        </td></tr>
                                </tbody></table>
                                    
                            <div class="comm_content_block_items">
                                <table width="100%" cellspacing="1" cellpadding="0" border="0" class="list_table">
                                    
                                    <tr>
                                        <th width="7%" valign="top" align="center">#</th>
                                        <th width="37%" valign="top" align="left"><a href="<?php echo ConfigUrl::base() ?>index/metatag/url/<?php echo $this->order == 'ASC' ? 'DESC' : 'ASC' ?>">Url</a></th>
                                        <th width="40%" valign="top" align="left"><a href="<?php echo ConfigUrl::base() ?>index/metatag/title/<?php echo $this->order == 'ASC' ? 'DESC' : 'ASC' ?>">Title</a></th>
                                        <th width="40%" valign="top" align="left"><a href="<?php echo ConfigUrl::base() ?>index/metatag/keyword/<?php echo $this->order == 'ASC' ? 'DESC' : 'ASC' ?>">Keyword</a></th>
                                        <th width="40%" valign="top" align="left"><a href="<?php echo ConfigUrl::base() ?>index/metatag/description/<?php echo $this->order == 'ASC' ? 'DESC' : 'ASC' ?>">Description</a></th>
                                            
                                        <th width="16%" valign="top" align="left">Action</th>
                                    </tr>
    <?php
    if (sizeof($this->resTags) > 0) {
        $i = 0;
        foreach ($this->resTags as $row) {
            $i++;
            ?>
                                            <tr class="row_color1">
                                                <td valign="top" align="center"><?php echo ($this->page - 1) * $this->pageMaxCount + $i; ?></td>
                                                <td  valign="top" align="left"><?php echo stripslashes($row->url) ?></td>
                                                <td valign="top" align="left"><?php echo stripslashes($row->title) ?></td>
                                                <td valign="top" align="left"><?php echo stripslashes($row->keyword) ?></td>
                                                <td valign="top" align="left"><?php echo stripslashes($row->description) ?></td>          
                                                <td   valign="top" align="left">
                                                    <a href="<?php echo ConfigUrl::base() ?>index/metatag?act=edit&id=<?php echo $row->id ?>">Edit</a>
                                                        
                                                </td>
                                            </tr>
                                                
            <?php
        }
    } else {
        echo '<tr class="row_color1">
                      <td colspan="6" align="center">No Records Found</td></tr>';
    }
    ?>
            
                                    </tbody></table>
                            </div>
                            <div class="clear"></div>
                                
                        </div></div>
                </div>
                <!--  start paging..................................................... -->
    <?php if ($this->pageCount > 1) { ?>
                            
                    <div class="pagination">
                        <ul>
                    <?php if ($this->page != 1) { ?>
                                <li><a href="<?php echo ConfigUrl::base() ?>index/metatag/<?php echo $this->sortfield ?>/<?php echo $this->order ?>?page=1&txtSearch=<?php echo $this->txtSearch ?>" class="page_first" >First</a></li>
                                <li><a class="page_prev" href="<?php echo ConfigUrl::base() ?>index/metatag/<?php echo $this->sortfield ?>/<?php echo $this->order ?>?page=<?php if ($this->page != 1) echo $this->page - 1; else echo $this->page; ?>&txtSearch=<?php echo $this->txtSearch ?>" >Previous</a></li>
                            <?php }
                            ?>
                            <li class="pageinfo"><div id="page-info">Page <strong><?php echo $this->page; ?></strong> / <?php echo $this->pageCount; ?></div></li>
                            <?php if ($this->pageCount != $this->page) { ?>
                                <li><a class="page_next" href="<?php echo ConfigUrl::base() ?>index/metatag/<?php echo $this->sortfield ?>/<?php echo $this->order ?>?page=<?php if ($this->pageCount != $this->page) echo $this->page + 1; else echo $this->pageCount; ?>&txtSearch=<?php echo $this->txtSearch ?>">Next</a></li>
                                <li><a class="page_last" href="<?php echo ConfigUrl::base() ?>index/metatag/<?php echo $this->sortfield ?>/<?php echo $this->order ?>?page=<?php echo $this->pageCount; ?>&txtSearch=<?php echo $this->txtSearch ?>" >Last</a></li>
                            <?php }
                            ?>
                        </ul>
                        <div class="clear"></div>
                    </div>
                            <?php
                        }
                        ?>
               
               
                <?php
            }
            ?>
        </div>
        <div class="clear"></div>
    </div>
</div>