Jump to content

s_ainley87

Members
  • Posts

    103
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

s_ainley87's Achievements

Member

Member (2/5)

0

Reputation

  1. Hello there, I am working on a project at the moment that requires some seriously skinned up select menus, I have managed to re-skin them but using this plugin however I have no way of determining what item has been selected from what select box as the plugin builds the same HTML every time it meets a select element in my HTML. I need some way of adding a unique identifier onto the end of a class, by manipulating the below plugin. $.fn.customSelect = function() { // define defaults and override with options, if available // by extending the default settings, we don't modify the argument return this.each(function() { obj = $(this); obj.after("<div class=\"selectoptions\"> </div>"); obj.find('option').each(function(){ $(".selectoptions").append("<div id=\"" + $(this).attr("value") + "\" class=\"selectitems\"><span>" + $(this).html() + "</span></div>"); }); obj.before("<input type=\"hidden\" value =\"\" name=\"" + this.name + "\" class=\"customselect\"/><div class=\"iconselect\">" + this.title + "</div><div class=\"iconselectholder\"> </div>") .remove(); $('.iconselectholder').hide(); $(".iconselect").click(function(){ $(".iconselectholder").toggle("slow");}); $(".iconselectholder").append( $(".selectoptions")[0] ); $(".selectitems").mouseover(function(){ $(this).addClass("hoverclass"); }); $(".selectitems").mouseout(function(){ $(this).removeClass("hoverclass"); }); $(".selectitems").click(function(){ $(".selectedclass").removeClass("selectedclass"); $(this).addClass("selectedclass"); var thisselection = $(this).html(); $(".customselect").val(this.id); $(".iconselect").html(thisselection); $(".iconselectholder").toggle("slow") }); }); // do the rest of the plugin, using url and settings }
  2. Hello, I have a page the makes an AJAX request, and returns some data from the database, once it is retruned I am trying to append it to a div and make an accordion, however all I am getting is the data back and no accordion here is my source code once the AJAX has run.(snippet) <script type="text/javascript"> $(document).ready(function() { //accordians for when the AJAX loads the content // hides the main_menu as soon as the DOM is ready // (a little sooner than page load) $('#main_menu').hide(); // shows the slickbox on clicking the noted link $('h3#show-menu a').click(function() { $('#main_menu').toggle('slow'); return false; }); //try and hide the left content when it is null $("#left-content:empty").hide(); //style up the scroll bar $('#left-content').jScrollPane(); //do some AJAX to call the method instead of the browser $("a.navlink").click(function (ev) { $(this).toggleClass("active"); ev.preventDefault(); var id = $(this).attr("id") if ($(this).hasClass("active")) { $("."+id).remove(); } else { //$(this).toggleClass("active"); var url = $(this).attr("href"); $.ajax ({ url: url, type: "POST", success : function (html) { $("#accordion").append(html); $('#accordion').accordion({ active: 0, header:'h2.Blog' }); //alert(accordion()) } }); } }); }); </script> </head> <body> <div style="left: -100em; position: absolute; width: 100em;"/> <div id="wrapper"> <h3 id="show-menu"> </h3> <div id="main_menu" style="display: block;"> </div> <div id="left-content-holder"> </div> <div id="right-content"> <div id="accordion" class="ui-accordion ui-widget ui-helper-reset" role="tablist"> <h2 class="Blog ui-accordion-header ui-helper-reset ui-state-active ui-corner-top" role="tab" aria-expanded="true" tabindex="0"> </h2> <div class="Blog ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content-active" style="height: 16px;" role="tabpanel">Hello World</div> </div> </div> </div> As you can see the data gets appended to the `<div id="accordion">` and all the apropriate classes get given to the elements that should give it accordion functionality but I get nothing. Should i be creating the accordion from the DOM and theoretically the data is returned is not in the HTML and if so how would I go about doing this? Thanks
  3. Hello, I am working on a one page website that allows the users to add and remove pages from there navigation as and when they would like too, the way it works is that if the click 'Blog' on the main nav a 'Blog' section should appear on the page, if they then click 'News' the 'News' section should also be visible, however the way I have started to implement this it seems I can only have one section at a time, can my code be adpated to allow multiple sections to shown on the main page. Here is my code for the page that has the main menu and the users selections on it. <!DOCTYPE html> <head> <title>Development Site</title> <link rel="stylesheet" href="/media/css/reset.css" media="screen"/> <link rel="stylesheet" href="/media/css/generic.css" media="screen"/> <script type="text/javascript" src="/media/javascript/jquery-ui/js/jquery.js"></script> <script type="text/javascript" src="/media/javascript/jquery-ui/development-bundle/ui/ui.core.js"></script> <script type="text/javascript" src="/media/javascript/jquery-ui/development-bundle/ui/ui.accordion.js"></script> <script type="text/javascript"> $(document).ready(function() { $('a.menuitem').click(function() { var link = $(this), url = link.attr("href"); $("#content_pane").load(url); return false; // prevent default link-behavior }); }); </script> </head> <body> <li><a class="menuitem" href="inspiration">Inspiration</a></li> <li><a class="menuitem" href="blog">Blog</a></li> <div id="content_pane"> </div> </body> </html>
  4. the qeury is built by Zend and _save function so I can't i dont think
  5. How can i insert the current datetime in my msql table using php, I ahve tried assing a variable like this $date = date("Y M D"); and send that but that does not work all i get is the default 0000-00-00 00:00:00. Any help out there? Thanks
  6. Hello, I have a mysql field of the datetime date type and I needing to break it apart when it is pulled out the database so that I can put each bit in its own section the page, how would I do this? I assumed it would be something like date('M', $data['updated_at']); *repeat for each section* however when I run this I get JAN 01 1970, I am asumming date can only be used with timestamps? if so I am stuck, could I convert the date to a time stamp and then do it or is there a quicker way? however this returns
  7. Hello, I am having a problem with my zend pagination, in that it is not pagination at, I try and set a limit of 4 record per page but it ignores, I can for the life in me see the problem I was hoping someone with sharp eyes could? model public function getAllNews() { $db = Zend_Registry::get('db'); $sql = "SELECT * FROM $this->_name WHERE flag = 1 ORDER BY created_at"; $query = $db->query($sql); while ($row = $query->fetchAll()) { $result[] = $row; } return $result; } controller $this->_helper->layout->setLayout('latestnews'); Zend_Loader::loadClass('newsArticles'); $allNews = new newsArticles(); $this->view->allNews = $allNews->getAllnews(); //die (var_dump($this->view->allNews)); $data = $this->view->allNews; // Instantiate the Zend Paginator and give it the Zend_Db_Select instance Argument ($selection) $paginator = Zend_Paginator::factory($data); // Set parameters for paginator $paginator->setCurrentPageNumber($this->_getParam("page")); $paginator->setItemCountPerPage(4); $paginator->setPageRange(4); // Make paginator available in your views $this->view->paginator = $paginator; //die(var_dump($data)); view <div id="rightColumn"> <h3>Latest News</h3> <?php if (count($this->paginator)): ?> <ul> <?php foreach ($this->paginator as $item): ?> <?php foreach ($item as $k => $v) { echo "<li>" . $v['title'] . "</li>"; } ?> <?php endforeach; ?> </ul> <?php endif; ?> <?= $this->paginationControl($this->paginator, 'Sliding', '/latestnews/partial_pagination_control.phtml'); ?> </div> pagination_template <?php if ($this->pageCount): ?> <div class="paginationControl"> <!-- Previous page link --> <?php if (isset($this->previous)): ?> <a href="<?= $this->url(array('page' => $this->previous)); ?>">< Previous</a> | <?php else: ?> <span class="disabled">< Previous</span> | <?php endif; ?> <!-- Numbered page links --> <?php foreach ($this->pagesInRange as $page): ?> <?php if ($page != $this->current): ?> <a href="<?= $this->url(array('page' => $page)); ?>"><?= $page; ?></a> | <?php else: ?> <?= $page; ?> | <?php endif; ?> <?php endforeach; ?> <!-- Next page link --> <?php if (isset($this->next)): ?> <a href="<?= $this->url(array('page' => $this->next)); ?>">Next ></a> <?php else: ?> <span class="disabled">Next ></span> <?php endif; ?> </div> <?php endif; ?> Any help would be great as I cannot work it out. Thanks everyone
  8. Hello, I am having a problem with my zend pagination, in that it is not pagination at, I try and set a limit of 4 record per page but it ignores, I can for the life in me see the problem I was hoping someone with sharp eyes could? model public function getAllNews() { $db = Zend_Registry::get('db'); $sql = "SELECT * FROM $this->_name WHERE flag = 1 ORDER BY created_at"; $query = $db->query($sql); while ($row = $query->fetchAll()) { $result[] = $row; } return $result; } controller $this->_helper->layout->setLayout('latestnews'); Zend_Loader::loadClass('newsArticles'); $allNews = new newsArticles(); $this->view->allNews = $allNews->getAllnews(); //die (var_dump($this->view->allNews)); $data = $this->view->allNews; // Instantiate the Zend Paginator and give it the Zend_Db_Select instance Argument ($selection) $paginator = Zend_Paginator::factory($data); // Set parameters for paginator $paginator->setCurrentPageNumber($this->_getParam("page")); $paginator->setItemCountPerPage(4); $paginator->setPageRange(4); // Make paginator available in your views $this->view->paginator = $paginator; //die(var_dump($data)); view <div id="rightColumn"> <h3>Latest News</h3> <?php if (count($this->paginator)): ?> <ul> <?php foreach ($this->paginator as $item): ?> <?php foreach ($item as $k => $v) { echo "<li>" . $v['title'] . "</li>"; } ?> <?php endforeach; ?> </ul> <?php endif; ?> <?= $this->paginationControl($this->paginator, 'Sliding', '/latestnews/partial_pagination_control.phtml'); ?> </div> pagination_template <?php if ($this->pageCount): ?> <div class="paginationControl"> <!-- Previous page link --> <?php if (isset($this->previous)): ?> <a href="<?= $this->url(array('page' => $this->previous)); ?>">< Previous</a> | <?php else: ?> <span class="disabled">< Previous</span> | <?php endif; ?> <!-- Numbered page links --> <?php foreach ($this->pagesInRange as $page): ?> <?php if ($page != $this->current): ?> <a href="<?= $this->url(array('page' => $page)); ?>"><?= $page; ?></a> | <?php else: ?> <?= $page; ?> | <?php endif; ?> <?php endforeach; ?> <!-- Next page link --> <?php if (isset($this->next)): ?> <a href="<?= $this->url(array('page' => $this->next)); ?>">Next ></a> <?php else: ?> <span class="disabled">Next ></span> <?php endif; ?> </div> <?php endif; ?> Any help would be great as I cannot work it out. Thanks everyone
  9. Hello, I am looking to send data to a mailbuild account using there API, but there docs are a bit poor and dont really explain how it is done, has any body achieved this and would be willing to pass on thir knowledge. All I wanting to do is add the name and email from form to mailbuild. Thanks
  10. Hello, I have this sql code that pulls out member details from a table public function getMemberAndLocationByName($name) { $db = Zend_Registry::get('db'); $name = $db->quote($name); $name = $name; $new_name = preg_replace("/[^a-zA-Z0-9s]/", "", $name); $sql = "SELECT $this->_name.*, locations.name as location from $this->_name LEFT JOIN locations on $this->_name.restaurant_id = locations.id where $this->_name.name LIKE '%$new_name%'"; //die($sql); $query = $db->query($sql); while ($row = $query->fetch()) { $result[] = $row; } //die(print_r($result)); return $result; } how do i then using oo and PHP5 print all the results on screen? Thanks
  11. Hello, I am currently trying to work something out in my head, I wanting to have a form that can add a user to a db and also edit the users. I want to use the same form for both tasks, but on the edit form on have the editable fields enabled. I am trying to work out the best way to ascertain whether the user is adding or editing a user. I thought about creating a function the creates a session called edit and then check for that session on my form page and if it matches run some javascript to disable the uneditable form fields. Or would a better way to do have so that if the user exists in the database it immediately goes to edit page with the disabled fields. Basically what I am asking is, it best to use a session or pass the user id, so it checks if it exists? Thanks
  12. You have used html comments, css comments look like this, /*This is a comment*/
  13. Hello I am currently working with str_replace and it cuasing me so much grief I a am so confused, I currently have this code, // where do we get the email assets from $this->image_path = "http://www.thiswebsite/assets/"; } public function sendVoucher() { //die("mail sent from mailer.php"); // takes subject (from TUID in translation file) and file name location/prefix, name of method in this class that we use to translate return $this->loadContentSend("voucher","emails/voucher_generic","translateTemplateVoucher"); } public function translateTemplateVoucher($template) { //die(print_r($this->inputs['offerdesc'])); require_once $this->global["rootpath"] . 'application/views/helpers/translate_functions.php'; $translated = str_replace("[header]", formatting($this->translation_data->_("header")),$template); $translated = str_replace("[iMAGEPATH]",$this->image_path,$translated); $translated = str_replace("[DOMAIN]",$this->inputs['domain'],$translated); $translated = str_replace("[ASSETNAME]",$this->inputs['asset'],$translated); $translated = str_replace("[OFFERNAME]",$this->inputs['offername'],$translated); $translated = str_replace("[OFFERSUB]",$this->inputs['offersub'],$translated); $translated = str_replace("[OFFERDESC]",$this->inputs['offerdesc'],$translated); $translated = str_replace("[OFFERTERMS]",$this->inputs['terms_and_conditions'],$translated); $translated = str_replace("[RESTAURANTNAME]",$this->inputs['rname'],$translated); $translated = str_replace("[restaurantname]",$this->inputs['rname'],$translated); $translated = str_replace("[trACKLINK]",$this->inputs['track'],$translated); $translated = str_replace("[validstart]",$this->inputs['vstart'],$translated); $translated = str_replace("[validend]",$this->inputs['vend'],$translated); $translated = str_replace("[NOT DISPLAYING]",$this->inputs['notdisplaying'],$translated); $translated = str_replace("[VID]",$this->inputs['vid'],$translated); $translated = str_replace("[bIRTHDAY AGE]",$this->inputs['birthday'],$translated); $translated = str_replace("[birthday age]",$this->inputs['birthday'],$translated); //die(print_r($this->data["track")); return $translated; } what I want is to be able to replace the [iMAGEPATH] if a condition is met, say that the territory_id of a website is 5 or 7 or whatever can anyone help?
  14. i currently have in my html document, a href="go.html">[iMAGEPATH] and in my php controller i have ($session = new Zend_Session_Namespace('Zend_Auth'); if($session = something) { str_replace('[iMAGEPATH]', 'http://www.myurl/image/myimage.gif', $variableHoldingYourPageInfo); } else { //do normal [iMAGEPATH] } what I am saying is that if i want the image that is replacing the original image to link somewhere else will i have to put the whole thing in str_replace including the link and how would i do it?
×
×
  • 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.