Jump to content

lional

Members
  • Posts

    271
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

lional's Achievements

Advanced Member

Advanced Member (4/5)

0

Reputation

  1. Hi, thanks, did some rough calculations and that should work, thanks a million
  2. Hi I am busy with a word press and I need to add leading zeros to a number in javascript so that for example 9 becomes 0.00009, and 30 becomes 0.00030 and 560 becomes 0.00560. I am very new to Javascript. I have been looking at the pad left functions. Is this the correct function or is there another one. Any help will be much appreciated
  3. Thanks for your input, I made some alterations since my post, still not working but I think I am closer. I moved my functions to the functions.php in my theme. Here are my two functions function getTierBLOne() { global $wpdb; $maincats = $wpdb->get_results( "SELECT * FROM nova_tp_forex_main_cats ORDER BY forex_name ASC" ); //$result_query = mysqli_query($conn,"SELECT * FROM nova_tp_forex_main_cats ORDER BY forex_name ASC"); //while ($tier = mysqli_fetch_array($result_query)) foreach($maincats as $maincat) { echo '<option value="' . $maincat->forex_id .'">'.$maincat->forex_name.'</option>'; } } if (isset($_GET['func'])&& $_GET['func'] == 'drop_bl' ) { drop_bl($_GET['drop_var']); } function drop_bl($drop_var) { global $wpdb; $subcats = $wpdb->get_results( "SELECT * FROM nova_tp_forex_main_subcats WHERE forex_main_cat = '$drop_var' ORDER BY forex_subcat_name"); echo '<select name="drop_2" id="drop_2"> <option value=" " disabled="disabled" selected="selected">Choose one</option>'; foreach($subcats as $subcat) { echo '<option value="'.$subcat->forex_subcat_id.'">'.$subcat->forex_subcat_name.'</option>'; } echo '</select> '; } Here is the latest version of my js file jQuery(document).ready(function() { jQuery('#wait_bl').hide(); jQuery('#drop_bl').change(function(){ alert( "Handler for .change() called." ); jQuery('#wait_bl').show(); jQuery('#result_bl').hide(); jQuery.post( nova_ajax_script.ajax_url, { action: "drop_bl", drop_var: jQuery('#drop_bl').val() }, function(response) { $('#result_bl').fadeOut(); setTimeout("finishAjax('result_bl', '"+escape(response)+"')", 400); }, )} ); }); function finishAjax(id, response) { jQuery('#wait_bl').hide(); jQuery('#'+id).html(unescape(response)); jQuery('#'+id).fadeIn(); } And here is my final plugin file <?php function js_enqueue_scripts() { wp_register_script('nova_ajax_script', plugins_url('js/nova-ajax.js', __FILE__), array('jquery'), null, true); wp_localize_script( 'nova-script', 'nova_ajax_script', array( 'ajax_url' => admin_url('admin-ajax.php')) ); } add_action( 'wp_enqueue_scripts', 'js_enqueue_scripts' ); function nova_options_page() { // Add top level admin menu add_menu_page('Nova Trade Signal', 'Nova Trade Signal', 'manage_options', 'nova', 'add_nova_trade_signal_html', plugins_url('Nova-Trade-Signals/images/icon_admin.jpg')); add_submenu_page('nova', 'Add Trade Signal', 'Add Trade Signal', 'manage_options', 'add_nova_trade_signal', 'add_nova_trade_signal_html'); add_submenu_page('nova', 'Update Trade Signal', 'Update Trade Signal', 'manage_options', 'update_nova_trade_signal', 'update_nova_trade_signal_html'); } /** * register our tv_options_page to the admin_menu action hook */ add_action('admin_menu', 'nova_options_page'); /** *function page for output of adding trade signal */ function add_nova_trade_signal_html() { ?> <select name="drop_bl" id="drop_bl" style="margin-top:0px;margin-left:35px"> <option value="" selected="selected" disabled="disabled">Select a Province</option> <?php getTierBLOne(); ?> </select> <span id="wait_bl" style="display: none;"> </span> <span id="result_bl" style="display: none;"></span> <?php } add_action('wp_ajax_drop_bl', 'drop_2'); add_action('wp_ajax_no_priv_drop_bl', 'drop_2'); ?>
  4. Sorry, I have another function page <?php //************************************** // Page load dropdown results // //************************************** function getTierBLOne() { include 'includes/conn_db.php'; $result_query = mysqli_query($conn,"SELECT * FROM nova_tp_forex_main_cats ORDER BY forex_name ASC"); while ($tier = mysqli_fetch_array($result_query)) { echo '<option value="'.$tier['forex_id'].'">'.$tier['forex_name'].'</option>'; } } //************************************** // First selection results // //************************************** if (isset($_GET['func'])&& $_GET['func'] == 'drop_bl' ) { drop_1($_GET['drop_var']); } function drop_1($drop_var) { include_once('includes/conn_db.php'); $result_query = mysqli_query($conn,"SELECT * FROM nova_tp_forex_main_cats WHERE forex_main_cat = '$drop_var' ORDER BY forex_subcat_name"); echo '<select name="drop_2" id="drop_2"> <option value=" " disabled="disabled" selected="selected">Choose one</option>'; while($drop_2 = mysqli_fetch_array($result_query)) { echo '<option value="'.$drop_2['forex_subcat_id'].'">'.$drop_2['forex_subcat_name'].'</option>'; } echo '</select> '; } ?> So what effectively happens (or suppose to happen) is the plugin page goes to this page to pull initial drop down data, then on change the ajax calls the next function to populate the second drop down
  5. Hi All I am trying to write chained selects for a WordPress plugin I am busy with. I have been struggling with it for a few days because my ajax is very weak. This is my file plugin file: <?php function js_enqueue_scripts() { wp_enqueue_script ("nova-ajax-handle", get_stylesheet_directory_uri() . "js/nova-ajax.js", array('jquery')); //the_ajax_script will use to print admin-ajaxurl in custom ajax.js wp_localize_script('nova-ajax-handle', 'nova_ajax_script', array('ajaxurl' =>admin_url('admin-ajax.php'))); } add_action("wp_enqueue_scripts", "js_enqueue_scripts"); ?> <select name="drop_bl" id="drop_bl" style="margin-top:0px;margin-left:35px"> <option value="" selected="selected" disabled="disabled">Select a Province</option> <?php getTierBLOne(); ?> </select> <span id="wait_bl" style="display: none;"> </span> <span id="result_bl" style="display: none;"></span> My Javascript file looks like this: $(document).ready(function() { $('#wait_bl').hide(); $('#drop_bl').change(function(){ $('#wait_bl').show(); $('#result_bl').hide(); $.ajax({ url: nova_ajax_script,ajax_url, type: get, func: "drop_bl", drop_var: $('#drop_bl').val() }), function(response) { $('#result_bl').fadeOut(); setTimeout("finishAjax('result_bl', '"+escape(response)+"')", 400); } return false; }); }); function finishAjax(id, response) { $('#wait_bl').hide(); $('#'+id).html(unescape(response)); $('#'+id).fadeIn(); } When I select my first dropdown, it does not fire up the second one. This is my very first attempt at WordPress development, so I might be making many errors Thank you
  6. Hi All I am trying to create a modal popup but I would like it to do the following 1. Load when the user enters the site, but only once not every time they navigate to a new page. 2. when they leave the site. again only when they leave the site not when they move from page to page. I am still busy on number 1 so I haven't started working on nr 2. I have got the popup part right but it loads every time the page is refreshed. I have been trying to play with cookies but then it doesn't load at all <script> if (once_per_session==0) $(document).ready(function() { if ($.cookie('20080521') != '1') { $('#myModal').modal('show'); $.cookie('20080521', '1', { domain: '', path: '' }); } }); </script> <div class="modal fade" id="myModal" role="dialog"> <div class="modal-dialog"> <!-- Modal content--> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> <h4 class="modal-title">Modal Header</h4> </div> <div class="modal-body"> <p>Some text in the modal.</p> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> </div> </div> </div> </div> <style> .modal{ position:fixed; top:0; right:0; bottom:0; left:0; z-index:1050; display:none; overflow:hidden; -webkit-overflow-scrolling:touch; outline:0 } .modal.fade .modal-dialog{ -webkit-transition:-webkit-transform .3s ease-out; -o-transition:-o-transform .3s ease-out; transition:transform .3s ease-out; -webkit-transform:translate(0,-25%); -ms-transform:translate(0,-25%); -o-transform:translate(0,-25%); transform:translate(0,-25%) } .modal.in .modal-dialog{ -webkit-transform:translate(0,0); -ms-transform:translate(0,0); -o-transform:translate(0,0); transform:translate(0,0) } .modal-open .modal{ overflow-x:hidden; overflow-y:auto } .modal-dialog{ position:relative; width:auto; margin:10px } .modal-content{ position:relative; background-color:#fff; -webkit-background-clip:padding-box; background-clip:padding-box; border:1px solid #999; border:1px solid rgba(0,0,0,.2); border-radius:6px; outline:0; -webkit-box-shadow:0 3px 9px rgba(0,0,0,.5); box-shadow:0 3px 9px rgba(0,0,0,.5) } .modal-backdrop{ position:fixed; top:0; right:0; bottom:0; left:0; z-index:1040; background-color:#000 } .modal-backdrop.fade{ filter:alpha(opacity=0); opacity:0}.modal-backdrop.in{ filter:alpha(opacity=50); opacity:.5 } .modal-header{ padding:15px; border-bottom:1px solid #e5e5e5} .modal-header .close{ margin-top:-2px } .modal-title{ margin:0; line-height:1.42857143 } .modal-body{ position:relative; padding:15px } .modal-footer{ padding:15px; text-align:right; border-top:1px solid #e5e5e5 } .modal-footer .btn+.btn{ margin-bottom:0; margin-left:5px } .modal-footer .btn-group .btn+.btn{ ; top:-9999px; width:50px; height:50px; overflow:scroll}@media (min-width:768px){ .modal-dialog{ width:600px; margin: 30px auto } .modal-content{ -webkit-box-shadow:0 5px 15px rgba(0,0,0,.5); box-shadow:0 5px 15px rgba(0,0,0,.5) }.modal-sm{width:300px}}@media (min-width:992px){ .modal-lg{ width:900px } } </style> Thank you in advance
  7. Hi I am trying to keep a tooltip on the page even when the user scrolls What I had in mind is keeping the the tooltip in a static position on the screen so as the user scrolls the position would stay teh same but for this to happen the margins would need to dynamically change. Here is my CSS so far /* Tooltip container */ .tooltip { /* border-bottom: 0px dotted black; If you want dots under the hoverable text */ } /* Tooltip text */ .tooltip .tooltiptext { border-radius: 5px 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.1); -webkit-box-shadow: 5px 5px rgba(0, 0, 0, 0.1); -moz-box-shadow: 5px 5px rgba(0, 0, 0, 0.1); font-family:Arial, Helvetica, sans-serif; font-size:16px; position: absolute; left: 1em; top: 2em; z-index: 99; margin-left: 350px; width: 450px; margin-top:25px; visibility:hidden; background-color: rgba(0, 75, 133, 0.5); opacity:0.6; padding-left:15px;padding-bottom:15px;padding-right:15px } /* Tooltip arrow */ .tooltip .tooltiptext::after { content: ""; position: absolute; top: 100%; left: 50%; ; border-width: 5px; border-style: solid; border-color: #555 transparent transparent transparent; } /* Show the tooltip text when you mouse over the tooltip container */ .tooltip:hover .tooltiptext { visibility: visible; opacity: 0.8; } My html line is repeated for each category which I have 17 categories <a data-image-id="1" class="navigation <ul> <li> <a data-image-id="1" class="navigation tooltip" href="#"><h2 style="text-align:center;margin-top:5px">Category1</h2><span class="tooltiptext">Tooltip Text</span></a> </li> <li> <a data-image-id="2" class="navigation tooltip" href="#"><h2 style="text-align:center;margin-top:5px">Category2</h2><span class="tooltiptext">Tooltip Text</span></a> </li> --> </li> and I have javascript to handle images changing <script type="text/javascript"> //<![CDATA[ window.onload=function(){ (function() { var images = { "1": "images/hygiene1.png", "2": "images/hygiene1.png", "3": "images/change_room.png", "4": "images/foam.png", "5": "images/drains.png", "6": "images/factory.png", "7": "images/cleaning.png", "8": "images/consumable.png", "9": "images/lifting.png", "10": "images/deboning.png", "11": "images/smoking.png", "12": "images/deboning.png", "13": "images/water.png", "14": "images/a_z.png", "15": "images/csk.png", "16": "images/boyens.png", "17": "images/galactic.png" }; var navTv = document.getElementById('nav-tv'); var arr = document.getElementsByClassName('navigation'); for(var i=0; i<arr.length; i++) { arr[i].onmouseover = function(e) { var a = e.target; var imgId = a.getAttribute('data-image-id'); var imgSrc = images[imgId]; var style = ['background-image: url(', imgSrc, ');'].join(''); navTv.setAttribute('style', style); } } })(); }//]]> </script> Any help pointing me in the right direction so that I can code it will be appreciated
  8. Hi I am trying to write a script that changes the background based on a navigation hover and I have got that part right. What I would like to further do is when I move off the navigation bar it remembers the last image, if this makes sense. Here is my code so far <nav> <ul> <li> <a href="#">Home</a> <img src="pic2.jpg" alt=""> </li> <li> <a href="#">About</a> <img src="pic3.jpg" alt=""> </li> <li> <a href="#">Clients</a> <img src="pic4.jpg" alt=""> </li> <li> <a href="#">Work</a> <img src="pic5.jpg" alt=""> </li> <li> <a href="#">Contact</a> <img src="pic6.jpg" alt=""> </li> </ul> </nav> <img src="pic1.jpg" alt=""> </div> and the css .container { position: relative; overflow: hidden; margin: 100px auto; width: 800px; height: 500px; -webkit-box-shadow: 10px 10px 10px rgba(0,0,0,0.3); box-shadow: 10px 10px 10px rgba(0,0,0,0.3); } .container img { position: absolute; top: 0; left: 0; z-index: -60; } .container li img { position: absolute; top: 0; left: 800px; z-index: -50; -webkit-transition: all 1s ease; -moz-transition: all 1s ease; -o-transition: all 1s ease; -ms-transition: all 1s ease; transition: all 1s ease; } nav { width: 170px; height: 500px; background: #fff; } nav h1 { padding: 20px; color: #ccc; text-align: right; font: 25px Georgia, Times, serif; } ul { width: 800px; height: 500px; list-style: none; } li a { z-index: 1; display: block; padding-left: 20px; width: 150px; height: 30px; background: white; color: #444; text-decoration: none; font: 14px/30px Helvetica, Verdana, sans-serif; } li:nth-child(1) { padding-top: 50px; } li a:hover { background: #eee; } li a:hover + img { left: 0px; } I think I would need javascript in here somehow. I am a newbie at javascript so if someone can point me in teh right direction it would be much appreciated.
  9. Hi I am trying to do a foreach loop withing a mysqli query I had it working with mysql but am struggling doing it with mysqli here is my code so far $query = mysqli_query($conn,'SELECT * FROM cooking_classes WHERE class_id IN (' . foreach ($_SESSION['cart'] as $key => $value) { $query .= $key . ','; } $query = substr ($query, 0, -1) . ')'; $result = mysqli_query($query) or die(mysqli_error()); Thanks in advance Lional
  10. No, I am using PHP mailer to send the mail. If I print the variable to screen before PHPmailer assigns the array it is correct, it is just when the array is done it only takes the last name
  11. Morning, At the top of the message I want to say Good Morning, John for example If the table field does not have a value in it then it should just say Good Morning However what is happening is it is attaching the last name in the Database to all the emails, so if Brian is the last name in the database table all the mails will day Good Morning, Brian instead of that persons individual name Thanks Lional
  12. Hi I am trying to write a script where each mail body has the clients name after the greeting $result_first = mysqli_query($conn,"SELECT * from clients WHERE profmed = '1' AND email != ''"); while ($row_first = mysqli_fetch_assoc($result_first)){ $surname_out = $row_first['surname']; $email_out = $row_first['email']; $firstname_out = $row_first['firstname']; $known_as_out = $row_first['known_as']; /*print $known_as_out;*/ $complete_name = $firstname_out . ' ' . $surname_out; $final_msg = $greeting_in_out . ' ' . $known_as_out . '<br /><br />' . $textToStore; $mail->Subject = $subject_out; $mail->IsHTML(true); $mail->Body = " <html> <head> <title></title> </head> <body> <table><tr><td> $final_msg $mail_sig</table></body></html>"; A quick explanation. The client sends through the greeting that he requires to send which is the variable $greeting_in_out, the persons name $known_as_out and the message ($textToStore) is appended to it. But $mail->Body only takes the last name pulled from the database. How can each mail have the persons name on the message Thank you Lional
  13. Thank you, I thought of that approach but the only issue I have with that is how would the client access the page outside of the site. would it be something like this: www.somedomain.com/buspage.php?usrid=(then the client id)
  14. Hi All I have a a directory website but numereous listings don't have their own website so they are requesting a single page to show a summary of their business and products. I know how to do most of it the part I am unsure of is: I have a form where they upload text, images, etc to a database and upload the images. what I would like to do is to save it as a file under a subdirectory. Is it possible to save a file php file using php Thank you in advance Lional
  15. Hi I am trying to write a nave bar where the sub menu and sub sub menu is pulled from mysql tables. It works but only pulls the first sub menu and does not roll to the second Here is my code $query4 = "SELECT * from categories WHERE active = '1'"; // display the products in each subcat $result4 = mysql_query($query4, $conn); while ($row4 = mysql_fetch_assoc($result4)){ $cat_id_out = $row4["cat_id"]; $category_out = $row4["category"]; echo '<li><a href=""><span>' . $category_out . '</span></a><ul>'; $query4 = "SELECT * from subcats WHERE cat_id = '$cat_id_out' AND active = '1'"; // display the products in each subcat $result4 = mysql_query($query4, $conn); while ($row4 = mysql_fetch_assoc($result4)){ $subcat_id_out = $row4["subcat_id"]; $subcategory_out = $row4["subcat"]; echo '<li><a href="products.php?subcat=' . $subcat_id_out . '"><span>' . $subcategory_out . '</span></a></li>'; } echo '</ul></li></ul></li>'; } Thanks in advance
×
×
  • 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.