Jump to content

Search the Community

Showing results for tags 'jquery'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

  1. im trying to grab something from the url bar , a phrase but it wont show up ?? please help ! <script type='text/javascript' src='jquery.min.js'></script> <script> function myFunction(sender) { var id = '#' + sender.getAttribute('href').split('#')[1]; or `'#' + sender.href.split('#')[1]` or `'#' + $(sender).attr('href').split('#')[1]` } </script> Copy and paste code from This page into the code box on the homepage and go claim your likes!!!<br> Your code is <script> document.write(myFunction()) </script>
  2. Hi guys, finally codeigniter seems to make a little sense when I gave it another go making a simple project and learning individual things to get there as opposed to just following the “blog tutorial”.. However I am trying to submit a form and do it through ajax/jquery so that the other page doesn’t show and everything happens in one page. This is from my view where the form and jquery is: jquery: <script> $(function(){ $("#form-signin").submit(function(){ dataString = $("#form-signin").serialize(); $.ajax({ type: "POST", url: "<?php echo base_url(); ?>index.php/welcome/addmovie", data: dataString, success: function(data){ alert('Successful!'); } }); return false; //stop the actual form post !important! }); }); </script> form: <form class="form-signin" method="post" id="form-signin"> <h4 class="form-signin-heading">Add a Movie</h4> <input type="text" class="input-block-level" placeholder="Movie Title"> <input type="text" class="input-block-level" placeholder="URL"> <input type="number" class="" min="1" max="100" placeholder="Jamies Score"> <input type="number" class="" min="1" max="100" placeholder="Kellys Score"> <button class="btn btn-large btn-primary" type="submit">Add</button> </form> It seems nothing happens when you click the submit button and I’ve put the script at the bottom of the page just before </body> as it seems when I put it under the form it doesn’t load the rest of the code below it? I am very new with jquery so please be kind. I don’t have anything in the script which the jquery should load (public function addmovie in the welcome controller) so it should return successfully I think? I hope someone can help me out! PS Using this tutorial: http://optimiseblog....niter-and-ajax/
  3. I am trying to get the radio's button value from the form to the javascript onclick function to my database. I define my $output in first.php then echo it in second.php. Here is my first.php $name = 100; $answer = "some text"; $output .= '<div id="'.$k.'"> <form id='.$f.' > <input type="radio" name='.$name.' value="yes" checked>Accurate <input type="radio" name='.$name.' value="no">Not Accurate <input type="button" id='.$j.' value="Submit" onclick="sendData(\''.$answer.'\','.$name.',)"> </form> </div>' ; $name++; My jquery function in second.php function sendData(feel, rID) { var accu = $("input[@name=rID]:checked").val(); $.get("test.php", { feeling: feel , accuracy: accu} ); } When I click my button nothing is submitted. If i manually define var accu to "YES" or something it works. So the problem must be on how to check if my radio button its checked and get its value.
  4. Hello, I am trying to pass PHP variables in a jquery function with the javascript onclick but its not working(i know it sounds confusing but I will explain). I define my $output in first.php then echo it in second.php. Here is my first.php $answer = "some text"; $output .= '<div id="'.$k.'"> <form id='.$f.' > <input type="radio" name="accuracy" value="yes" checked>Accurate <input type="radio" name="accuracy" value="no">Not Accurate <input type="button" id='.$j.' value="Submit" onclick="sendData('.$answer.')"> </form> </div>'; My jquery function in second.php function sendData(feel) { $.get("test.php", { feeling: 'feel'} ); } My test.php : $f= $_GET["feeling"]; $con = mysql_connect('localhost', 'username', 'pass'); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("mydatabase", $con); $sql="INSERT INTO testtable (testcolumn) VALUES ('$f')"; $result = mysql_query($sql); echo '<p2> Thank you. Your opinion is much appreciated!</p2>'; mysql_close($con); An entry is added in the database but with an empty value. Any idea where is the problem? Thanks
  5. I have this code <script type="text/javascript"> $(document).ready(function() { // I added the video size here in case you wanted to modify it more easily var vidWidth = 300; // 425; var vidHeight = 200; // 344; var obj = '<object width="' + vidWidth + '" height="' + vidHeight + '">' + '<param name="movie" value="http://www.youtube.com/v/[vid]&hl=en&fs=1">' + '</param><param name="allowFullScreen" value="true"></param><param ' + 'name="allowscriptaccess" value="always"></param><em' + 'bed src="http://www.youtube.com/v/[vid]&hl=en&fs=1" ' + 'type="application/x-shockwave-flash" allowscriptaccess="always" ' + 'allowfullscreen="true" width="' + vidWidth + '" ' + 'height="' + vidHeight + '"></embed></object> '; $('.posthold:contains("youtube.com/watch")').each(function() { var that = $(this); var vid = that.html().match(/v=([\w\-]+)/g); // end up with v=oHg5SJYRHA0 that.html(function(i, h) { return h.replace(/(http:\/\/www.youtube.com\/watch\?v=+\S+\S?)/g, ''); }); if (vid.length) { $.each(vid, function(i) { that.append(obj.replace(/\[vid\]/g, this.replace('v=', ''))); }); } }); }); </script> It works great at embeding videos from url's. But I have a small problem with it that I have been trying to solve but i keep breaking the code. Basically I have the following div setup <div class="grid_10 alpha omega posthold" > <div class="clearfix"> <div class="grid_2 alpha"> <img src="/images/no-image/logo_default.jpg" width="100" height="100" /> </a></div> <div class="grid_8 omega"> <h1>Some Name Here</h1> <p>Some Comment here</p> </div> </div> </div> Im trying to get the video to appear directly after the closing paragraph tag where it says some comment here. The user enters the video as part of a post. I store the post in a database and when I pull the post out I swap the url from youtube to the embed code. This is a repeating div so there maybe many instances that a video appears. Is this even possible. At the minute the video appears after the last closing div tag.
  6. Hello to everyone!! I just messed around with javascript and I build this : Just search for a video and click it and then it will go into playlist.Playlist stay saved even if you quit browser!! http://crispo.tk Any critics will be appreciate!! P.S : I know it dosen't work with IE( sucks) and is heavly depedent on javascript!
  7. Hello.. In my search bar I used jquery auto complete function to display related result for the searching keyword. It is working perfectly and now I'm looking for a way to increase the usability of it.. this is so far from my database file... <?php require_once('database.php'); if(isset($_POST['queryString'])) { $queryString = $dbc->real_escape_string($_POST['queryString']); if(strlen($queryString) >0) { $q = "SELECT keyword FROM ( SELECT tname AS keyword FROM t UNION SELECT sname AS keyword FROM sub UNION SELECT cname AS keyword FROM c UNION SELECT iname AS keyword FROM i ) s WHERE keyword LIKE '%$queryString%' LIMIT 10"; $r = mysqli_query ( $dbc, $q); if($q) { while ($row = mysqli_fetch_array($r, MYSQL_ASSOC)) { echo '<li onclick="fill(\''.$row['keyword'].'\');">'.$row['keyword'].'</li>'; } } else { echo 'ERROR: There was a problem with the query.'; } } else { } } else { echo 'There should be no direct access to this script!'; } ?> This is from my index page with jquery <script type="text/javascript" src="jquery-1.7.1.js"></script> <script type="text/javascript"> function lookup(inputString) { if(inputString.length == 0) { $('#suggestions').hide(); } else { $.post("rpc.php", {queryString: ""+inputString+""}, function(data){ if(data.length >0) { $('#suggestions').show(); $('#autoSuggestionsList').html(data); } }); } } function fill(thisValue) { $('#inputString').val(thisValue); setTimeout("$('#suggestions').hide();", 200); } </script> My problem is auto complete box display all values all together in this case subjects, tutor names, institutes names, city etc. So I'd like the results from the autocomplete function to be separated into categories. For example, if a user starts typing "an", the autocomplete will show 4 categories with items in each. if a user wants to select one of the items in the list under category "Subject". can any body tell me how can I do this? any comments are greatly appreciated. Thank you.
  8. I have called some ajax to bring in some html. In their html there is a form with select box's which i have a replacement plugin. However, i have included my plugin and applied it in the main html document and wrapped in in the document ready function but it just won’t apply to new dom elements with the ajax call. Andy ideas?
  9. Hi there, Basically what i need is for my site to not refresh every time i click one of the buttons. I have got as far as finding out that it requires AJAX but i don’t have a clue how to use it This is some of my code...it basically covers the main parts but if you need more then please ask... <html> <head> <script> $(function() { var tabs = $( "#tabs" ).tabs({collapsible: true, active:"flase"}); tabs.find( ".ui-tabs-nav" ).sortable({axis:"x", stop:function() {tabs.tabs( "refresh" );} }); }); $(function() { $( ".box" ).draggable({containment: "#restrictor", scroll: false, snap: true, opacity: 0.35, cancel: ".box-content" }); $( ".box" ).addClass( "ui-widget ui-widget-content ui-corner-all" ) .find( ".box-header" ) .addClass( "ui-widget-header ui-corner-all" ) .prepend( "<span class='ui-icon ui-icon-minusthick'></span>") .end() .find( ".box-content" ); $( ".box-header .ui-icon" ).click(function() { $( this ).toggleClass( "ui-icon-minusthick" ).toggleClass( "ui-icon-plusthick" ); $( this ).parents( ".box:first" ).find( ".box-content" ).toggle(); }); $( "#container" ).disableSelection(); }); $(function() { $( "input[type=submit], #Buttons, button" ) .button() .click(function( event ) { event.preventDefault(); }); }); setInterval(function() { $('#timeval').load('Home_Automation/Includes/time.php'); }, 1000); </script> </head> <body> <!------------------------Serial Port/Commands/Functions---------------------------> <?php if (isset($_GET['action'])) { require("Home_Automation/Includes/php_serial.class.php"); $serial = new phpSerial(); $serial->deviceSet("COM3"); exec('mode COM3 BAUD=96 PARITY=n DATA=8 STOP=1 xon=off octs=off rts=on'); $serial->deviceOpen(); if ($_GET['action'] == "on") { $serial->sendMessage("L"); $file = fopen("Home_Automation/Includes/lights.txt","w"); fwrite($file, "1"); fclose($file); } else if ($_GET['action'] == "off") { $serial->sendMessage("l"); $file = fopen("Home_Automation/Includes/lights.txt","w"); fwrite($file, "0"); fclose($file); } else if ($_GET['action'] == "unlock") { $serial->sendMessage("D"); $file = fopen("Home_Automation/Includes/doors.txt","w"); fwrite($file, "1"); fclose($file); } $serial->deviceClose(); } ?> <!--------------------------------Main Container-----------------------------------> <div id="restrictor" class="ui-widget-content"> <!--------------------------------Controll Switches--------------------------------> <!-------------------------------------Doors---------------------------------------> <div class="box"> <div class="box-header">Doors</div> <div class="box-content"> <a class="button" href="<?php echo $_SERVER['PHP_SELF'] . '?action=unlock' ?>">Unlock</a> <div id="PHP"> <?php $file = fopen("Home_Automation/Includes/doors.txt", "r") or exit("Unable to open file!"); if (fgetc($file)==1) echo "<img src=\"Home_Automation/Images/Door_Open.gif\" />"; else echo "<img src=\"Home_Automation/Images/Door_Closed.gif\" />"; fclose($file); ?> </div> <a class="button" href="<?php echo $_SERVER['PHP_SELF'] . '?action=lock' ?>">Lock</a> </div></div> </div> </html> It’s not really in order as i cut bits out but that covers the basic code... If someone could please show me some code snippets that i would need to include or something that would be great Thanks, Chris
  10. hi guys please could you help do this i tried to read about jquery , ajax , json but i just got really lost so i am asking for help to guide me to the right way and thank you so much. what i want to do is this : take this from in html <form method="GET" action="https://exemple.com/.../api/work.php"> <input type="hidden" name="method" value="link"/> <input type="text" name="params[login]" value="ready" /> </br><input type="text" name="params[pass]" value="download"/></br> <input type="text" size="80" name="params[link]" placeholder="get ready"/></br> <input type="submit" formtarget="txt" value="Submit"> </form> <iframe type="hidden" name="txt"></iframe> And turn it to this <form> <input type="text" size="80" name="params[link]" placeholder="get ready"/></br> <input type="submit" formtarget="txt" value="Submit"> </form> <iframe type="hidden" name="txt"></iframe> i want to validate - the the first input with name="method" value="link" -the second input with name="params[login]" value="ready" -the third input with name="params[pass]" value="download" to this url https://exemple.com/api/work.php ( this is a different domain "cross domain") with the GET request conclusion i don't want the visitor the see the url or the 3 inputs they can pnly submit the link they want to check thank you so much i hope someone can guide me to the right way i am so lost now
  11. So i am looping through a JSON string and i want to get the value of the key itself. I want to get this so i can use it to populate some navigation type menus. I can access elements of the object by: obj.A1.description and it will give me the value of the description object but i want to get the value of the key itself. Instead of knowing that the key is A1 i want to pull the value of each key with the $.each loop. Current JSON string: {"pack1":{"A1":{"description":"some text goes here","image":"image1 here"}},"pack2":{"A2":{"description":"more text here","image":"image2 here"}}}
  12. i have image slider it was working fine but i made add some content to it since then its not sliding images as before you can check it here:- http://boysjoys.com/test at first it show all the image properly but when it start scrolling it become unstable i m adding slider coding here please help me and i m including these files <script type="text/javascript" src="final/scripts/jquery-1.4.1.min.js"></script> <script type="text/javascript" src="final/scripts/jquery.easing.1.3.js"></script> <script type="text/javascript" src="final/scripts/jquery.timers.1.2.js"></script> <script type="text/javascript" src="final/scripts/jquery.galleryview.2.1.1.min.js"></script> <script type="text/javascript" src="final/scripts/jquery.galleryview.setup.js"></script> <div class="wrapper"> <div class="container"> <div class="content"> <div id="featured_slide"> <ul id="featurednews"> <!-- ####################################----SLIDE START----############################### --> <li><img src="final/images/slides/slides/israel-gaza-rocket_2399203b.jpg" alt=""/> <!-- slide --> <div class="panel-overlay"> <h2>Hamas commander Killed In Israel airstrikes against Gaza Strip </h2> <p style="font-size:12px; font-family: 'Lucida Grande', Tahoma, Verdana, Arial, sans-serif; line-height:129%"><a href="news/Israel_launches_airstrikes_against_Gaza_Strip_kills_Hamas_commander.php">Israel has launched a series of airstrikes against military targets inside the Gaza Strip, killing a senior Hamas leader.<br /></a> </p> </div> </li> <!-- ####################################----SLIDE STOP----############################### --> <!-- ####################################----SLIDE START----############################### --> <li><img src="final/images/slides/slides/google-self-driving-car.jpg" alt="" /> <!-- slide --> <div class="panel-overlay"> <h2>Google gets license to operate driverless cars</h2> <p style="font-size:12px; font-family: 'Lucida Grande', Tahoma, Verdana, Arial, sans-serif; line-height:129%"><a href="news/google-gets-license-to-operate.php">Nevada became the first to approve a license for Googles autonomous vehicles.In other words, cars that cruise, twist and turn without the need for a driver<br /></a> </p> </div> </li> <!-- ####################################----SLIDE STOP----############################### --> <!-- ####################################----SLIDE START----############################### --> <li><img src="final/images/slides/slides/windows8startscreen-100010356-large.jpg" alt="" /> <!-- slide --> <div class="panel-overlay"> <h2>New Microsoft Windows 8 tips and tricks for beginners</h2> <p style="font-size:12px; font-family: 'Lucida Grande', Tahoma, Verdana, Arial, sans-serif; line-height:129%"><a href="news/windows_8_tips.php">Microsoft Windows 8 is now out and available on a whole host of different devices, ranging from your average desktop to super-slim touchscreen laptops and even tablets<br /></a> </p> </div> </li> <!-- ####################################----SLIDE STOP----############################### --> <!-- ####################################----SLIDE START----############################### --> <li><img src="final/images/slides/slides/Alleyne 2.jpg" alt="" /> <!-- slide --> <div class="panel-overlay"> <h2>Trinidad TV host charged over teen rape footage</h2> <p style="font-size:12px; font-family: 'Lucida Grande', Tahoma, Verdana, Arial, sans-serif; line-height:129%"><a href="news/Trinidad_TV_host_charged_over_teen_rape_footage.php">Ian Alleyne, host of Trinidad TV has been charged with crimes under Sexual Offences Act after a tape purporting to show a mentally ill teenage girl being raped was allegedly broadcast last year.<br /></a> </p> </div> </li> <!-- ####################################----SLIDE STOP----############################### --> <!-- ####################################----SLIDE START----############################### --> <li><img src="final/images/slides/slides/gs3-iphone-ad.jpg" alt="" /> <!-- slide --> <div class="panel-overlay"> <h2>Fall Season Smartphone Wars: Samsung's Galaxy S3 Vs Apple's iPhone 5 </h2> <p style="font-size:12px; font-family: 'Lucida Grande', Tahoma, Verdana, Arial, sans-serif; line-height:129%"><a href="news/samsung_galaxy_s3_vs_apple_iphone5.php">Samsung Or Apple,Who is the best of the best in the smartphone market.<br /></a> </p> </div> <!-- ####################################----SLIDE STOP----############################### --> <!-- ####################################----SLIDE START----############################### --> <li><img src="final/images/slides/slides/2011_08_SocialMedia.jpg" alt="" /> <!-- slide --> <div class="panel-overlay"> <h2>Youths And Social Networking </h2> <p style="font-size:12px; font-family: 'Lucida Grande', Tahoma, Verdana, Arial, sans-serif; line-height:129%"> <a href="news/YouthsAndSociaNetworking.php">The world is undergoing a rapid growth in technological advancement and information dissemination is now easier and faster through the use of the internet.<br /></a> </p> </div> <!-- ####################################----SLIDE STOP----############################### --> <!-- ####################################----SLIDE START----############################### --> <li> <img src="final/images/slides/slides/aunt-minnies-place-haunted-31000.jpg" alt="" /> <!-- slide --> <div class="panel-overlay"> <h2>World Most Scariest Places</h2> <p style="font-size:12px; font-family: 'Lucida Grande', Tahoma, Verdana, Arial, sans-serif; line-height:129%"> <a href="news/worlds10scariestplaces.php">There are places on this planet that are stranger than the most alien landscapes we have ever imagined. Places that make your skin crawl.<br /></a> </p> </div> <!-- ####################################----SLIDE STOP----############################### --> <!-- ####################################----SLIDE START----############################### --> <li><img src="final/images/slides/slides/deidresplashpic_395714a.jpg" alt="" /> <!-- slide --> <div class="panel-overlay"> <h2>Does My Ex Just Want Me For Sex</h2> <p style="font-size:12px; font-family: 'Lucida Grande', Tahoma, Verdana, Arial, sans-serif; line-height:129%"> <a href="news/ex_for_sex.php">Is your ex using you for sex or do they truly want you back?<br /> </a> </p> </div> <!-- ####################################----SLIDE STOP----############################### --> <!-- ####################################----SLIDE START----############################### --> <li> <img src="final/images/slides/slides/GeorgeEntwistle.JPG" alt="" /> <!-- slide --> <div class="panel-overlay"> <h2>BBC Director-General Entwistle resigns </h2> <p style="font-size:12px; font-family: 'Lucida Grande', Tahoma, Verdana, Arial, sans-serif; line-height:129%"> <a href="news/BBC_Director-General_Entwistle_resigns.php">Director-General of the BBC George Entwistle resigned.Mr Entwistle said he would stay on as Director-General but he said he was doing the "honourable thing" by stepping down.</a> </p> </div> </li> <!-- ####################################----SLIDE END----############################### --> <!-- ####################################----SLIDE END----############################### --> </ul> </div> </div>
  13. * i want to display alert message in my page where actual the form is located... * i have 2 pages 1--> user interace page with registration form 2--> a php page called by ajax callback function to add a form data to database without redirecting from my first page now the problem is i want to display jqery alert or simple javascript alert on my first page(where actual the form) based on the result of second php page eg:Thank u mr $name for registration.your registration id is $regid or eg:this username alreday exists... this is my simple ajax call back script ---------------------------------------------- <script> // wait for the DOM to be loaded $(document).ready(function() { // bind 'myForm' and provide a simple callback function $('#myform').ajaxForm(function() { }); }); </script> the second page just cathces form data and generates random registartion id eg: $first_name = $_POST["first_name"]; $last_name = $_POST["last_name"]; $memberid = rand(1000000000,9999999999); please any one help me soon to come out o this big struck... thank you......
  14. Ok, so here's my problem. I have a table class built in javascript using jquery. What I want to add to the class is select box functionality. I have been using ajax search type functionality which has worked, but now, I want to add an actual select box. So when a user double clicks on a cell, a select box pops up in the cell. When a user changes the select box it is easy and I can run a change event to submit the data to my db and update the cell. This also gets rid of the select box. My problem now, is the hypothetical event that a user double clicks the cell but does not change anything in the select box. What would be a possible strategy to allow the onchange event to trigger but also allow an "onblur" event to happen if the user does not select anything. I don't need all the coding, just a theory or help from anyone who knows how to do this. Thanks in advance
  15. Ok, this is not a question where I am having issues, but seeking an advise from you on JQuery plugin development. We have to agree, there are many JQuery plugins in different categories such as image gallery, form validations, effects and so on. I was about to create a basic JQuery plugin with methods. I am new in JQuery plugin development, but I do have my required tutorials to create one and I did make one before when learning. The question is: Is it worth to create a JQuery plugin with methods, or simply create an open source script plugin, where a user can modify freely and embed it in their websites? In other words, I do not see a huge difference, by creating a JQuery plugin with methods, with an open source JQuery or Javascript plugin without methods where you can customize freely. For example, there is TinyMCE, a rich text editor, it is a plugin in pure Javascript and does not propose methods for people to modify. If you want to modify to add/remove features, simply do it by coding as it is open source. TinyMCE just propose you a default functionality. However, the only advantage a JQuery plugin with methods will have is to let people who have poor knowledge on web to configure their plugin easily while an open source script plugin like TinyMCE for instance, you need to code by yourself if you want to ameliorate. What do you think?
  16. I'm working on user registration/account management. I want to validate the old user password with AJAX, before the new password is being sent to the php script. So I want to wait for the AJAX to tell me whether the PW is correct or not and then either return false (stop posting the form), or go on. The problem is, the form is always posted. I don't know where to put the 'return false'. I've tried loads of different options, but it still won't work. If anyone could just take a look, it'd be much appreciated. This is how the button.click method looks like: { var current_pwd = $( '#current_password' ).attr( 'value' ); var pw_correct = false; $.ajax({ url: ajax_vars.ajax_url, type: 'POST', async: false, data: 'action=check_pw&pw='+current_pwd, success: function( data ) { pw_correct = data } }); if (!pw_correct) { alert('wrong pw'); return false; } } I tried to put it in 'complete' and 'success' callbacks, tried with async = true and false, but it still doesn't seem to work.
  17. I've been trying to append an element to the bottom of another using jquery; however, it does not work. Here is my code: <?php $currentPath = $this->getCurrentPath(); $currentCategory = Mage::registry('current_category'); ?> <script type="text/Javascript"> jQuery(document).ready(function(){ $(".childnav").appendTo(".catalognav"); }); </script> <ul class="catalognav"> <?php foreach ($this->getCategories() as $category): ?> <li> <a<?php if ($currentCategory->getId() == $category->getId()): ?> class="selected" <?php endif ?> href="<?php echo $category->getUrl() ?>"><?php echo $category->getName() ?></a> </li> <li><span>/</span></li> <?php if ($currentCategory->getId() == $category->getId() || in_array($category->getId(), $currentPath)): ?> <ul class="childnav"> <?php foreach ($this->getSubcategories($category->getId()) as $subcategory): ?> <li><a<?php if ($currentCategory->getId() == $subcategory->getId()): ?> class="selected" <?php endif ?> href="<?php echo $subcategory->getUrl() ?>"><?php echo $subcategory->getName() ?></a></li> <li><span>/</span></li> <?php endforeach ?> </ul> <?php endif ?> <?php endforeach ?> </ul> Basically nothing happens. What I get is this: <ul class="catalognav"> <li> <a class="selected" href="#">Tops /</a> </li> <ul class="childnav"> <li><a href="#">Shirts /</a></li> <li><a href="#">Sweaters /</a></li> <li><a href="#">Tees /</a></li> <li><a href="#">Hoodies and Sweatshirts /</a></li> </ul> <li> <a href="#">Denim /</a> </li> <li> <a href="#">Outerwear /</a> </li> </ul> What I want is: <ul class="catalognav"> <li> <a class="selected" href="#">Tops /</a> </li> <li> <a href="#">Denim /</a> </li> <li> <a href="#">Outerwear /</a> </li> <ul class="childnav"> <li><a href="#">Shirts /</a></li> <li><a href="#">Sweaters /</a></li> <li><a href="#">Tees /</a></li> <li><a href="#">Hoodies and Sweatshirts /</a></li> </ul> </ul> Hopefully that made sense. Thanks for any help in advanced!
  18. Hi there, I am in the process of building a penny auction website using php / javascript. I am at the stage of developing the bidding process by which someone clicks to bid on an item, this resets a time counter and this runs over and over until someone wins when the clock strikes 00:00. My understanding is that I would be updating various database tables with the bidder information, updating the time remaining and doing this every second which would require a cronjob to be run on the server every second. I wondered if anyone had real experience of working with / building one of these websites as this is slightly new to me? What I am unsure about is how complicated this constant requesting and serving information is? What are the best things to use to get / set the information. I was planning on using php to update a table with the new bidder information and the date/time. This would also update the product with the time remaining. If a new user bids this overwrites this information and the process starts again. Any information would be a massive help and much appreciated. Thanks Simon
  19. Hello, I have an issue. I have 10 images in a div. The images' names are in a second div. So, there are 10 images and 10 names. When a user will click on an image, it will hide as well as its respective name. So, if the user clicks on the second image, it will hide as well as its name until everything is hidden. Once the user has clicked all images, an alert box will appear. Refer to the code now for a single image: $(document).ready (function() { $("#image").click(function() { $("#image, #name").hide("slow"); if ($("#image").is(":hidden")) { alert("Ok"); }; }); }); As you see, when the user will click an image, it will hide as well as well the name. This goes the same for all images. The alert box will be displayed once the image is hidden else not, so I have to verify if the image is hidden. I could give them a single class instead of an ID, but the user can click only on the image div. Bear in mind, the above example is just for one image only. I have 10 images, but decided to include example for one in general to make you understand. The image and the name are hiding, but the alert box is not displayed!
  20. Hi guys, ive got an awkward problem that doesn't seem to want to fix itself no matter how hard i try. Basically, I have in my Database a table called horses and the columns are I then have a php webpage with a dropdown box which is populated from the database. <form action="" method="post" align="center"> <fieldset> <select name="horses" onchange="benSucksDick(this.value)" align="center"> <option value="">Select a Horse</option><Br><br><br> <!-- RUN QUERY TO POPULATE DROP DOWN --> <?php mysql_connect("localhost", "root", "") or die("Connection Failed"); mysql_select_db("horse")or die("Connection Failed"); $query = "SELECT * FROM horses ORDER by ID"; $result = mysql_query($query) or die(mysql_error()); /*$num = mysql_num_rows($result);*/ while($row = mysql_fetch_array($result)) { echo "<option value='".$row['ID']."'>".$row['Name']."</option>"; } ?> </select></fieldset> I also have a AJAX call to edit.php which fetches the data in column web_horse and outputs it to a CKeditor instance. AJAX code <script type="text/javascript"> function benSucksDick(str) { if (str=="") { document.getElementById("maincontent").innerHTML=""; return; } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("maincontent").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","content/edit.php?q="+str,true); xmlhttp.send(); } </script> edit.php Code <?php error_reporting(-1); // Make sure you are using a correct path here. include 'ckeditor/ckeditor.php'; $ckeditor = new CKEditor(); $ckeditor->basePath = '/ckeditor/'; $ckeditor->config['filebrowserBrowseUrl'] = '/ckfinder/ckfinder.html'; $ckeditor->config['filebrowserImageBrowseUrl'] = '/ckfinder/ckfinder.html?type=Images'; $ckeditor->config['filebrowserFlashBrowseUrl'] = '/ckfinder/ckfinder.html?type=Flash'; $ckeditor->config['filebrowserUploadUrl'] = '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files'; $ckeditor->config['filebrowserImageUploadUrl'] = '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images'; $ckeditor->config['filebrowserFlashUploadUrl'] = '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash'; mysql_connect("localhost", "root", "") or die("Connection Failed"); mysql_select_db("horse")or die("Connection Failed"); $q=$_GET["q"]; $sql="SELECT web_content FROM horses WHERE id = '".$q."'"; $resultab = mysql_query($sql); while($row = mysql_fetch_array($resultab)) { echo $row['web_content']; } ?> Now, the CKeditor initialises when the page is loaded, but when i change the dropdown to a different value from the database it just shows the html code and/or a text area WITHOUT the CKeditor instance. If anyone can help me, that would be grand!!
  21. Hi Guys, I have a set of script to send data via checkbox toggle. After a checkbox is checked. A value is sent from PHP as 1. So I test the value within success callback. Everythings works fine but I can't make the background color change according to the given value from php. Please have give me a hand. <script type="text/javascript"> jQuery(function($){ $('input[name=alm]').click(function(){ var id=$(this).attr('id'); var alm=$(this).val(); $.ajax({ type:'GET', url:'inc/villas_allotment_ajax_update.php', data:'id='+id+'&alm='+alm, /*success: function (result) {$('#bg').css("background-color", "#66cc00");alert(data);}, error: function (result) {$('#bg').css("background-color", "#ff8080");},*/ success: function(html) { if(html=="1"){//change td bg to green if succeed $('#bg').css("background-color", "#66cc00"); alert(html); }else{ $('#bg').css("background-color", "#ff8080"); alert(html); } } }); }); }); </script> Here's my html: <table> [indent=1]<tr>[/indent] [indent=2]<td id="2012-11-01-001" align="center"><input type="checkbox" id="2012-11-01-001" name="alm" value="1" checked /></td>[/indent] [indent=2]<td id="2012-11-02-001" align="center"><input type="checkbox" id="2012-11-02-001" name="alm" value="1" checked /></td>[/indent] [indent=2]<td id="2012-11-03-001" align="center"><input type="checkbox" id="2012-11-03-001" name="alm" value="1" checked /></td>[/indent] [indent=2]...[/indent] [indent=2]<td id="2012-11-30-001" align="center"><input type="checkbox" id="2012-11-30-001" name="alm" value="1" checked /></td>[/indent] [indent=1]</tr>[/indent] </table> The questions is: How can I change the td background-color after a callback is proved (html=="1") according to its td.id (not #bg as I wrote) Please help me out, I've spent many hours to solve this including some samples from this website.
  22. Hi! (I am hoping I have placed this post in the right forum) I am having some issues with the Nivo slider. I have multiple sliders on the website (one that you can see just visiting the site and then a couple of others that are viewed when clients login). Anyway, the issue that I am having is trying to get the second slider (the one featured on the main site) to see the custom CSS that I wrote for it -- specifically in regards to the nivo-controlNav selector. Here is what i've tried: (the second slider ID is #mainSlider) #mainSlider .nivo-controlNav { position:relative; left:122px; top:12px; } I've also tried adding a z-index to this of 9999. I've also added custom css to the javascript: <script> $(document).ready(function() { $('nivo-controlNav).css('position','relative'); $('nivo-controlNav).css('left','122px'); $('nivo-controlNav).css('top','12px'); $('#mainSlider').nivoSlider({ effect: 'fade', // Specify sets like: 'fold,fade,sliceDown' slices: 15, // For slice animations boxCols: 8, // For box animations boxRows: 4, // For box animations animSpeed: 500, // Slide transition speed pauseTime: 7000, // How long each slide will show directionNav: true, // Next & Prev navigation directionNavHide:true, //Only show on hover controlNav: true, // 1,2,3... navigation controlNavThumbs: false, // Use thumbnails for Control Nav }); }); </script> and so on. That didn't work either. Then, I went into the javascript file and tried to add a new class -- .nivo-controlNav2. However, I don't think I went about it the right way as it messed up the controlNav css for the other slider. I tried loading a custom theme in the <head> and then added this to the slider wrapper: <div class="slider-wrapper2 theme-mytheme"> After that, I made sure that my css had .mytheme listed first and then .nivo-controlNav listed after it. At this point, i'm frustrated. I've done everything that *I* know how to do and have scoured the internet for answers. Here is the site: http://diocesan.com/testsite Help! and thank you in advance for any help, suggestions or advice you can give.
  23. I am using this code below to check/uncheck a checkbox that is inside a DIV, upon clicking anywhere on the DIV... $("#checkbox").live('click', function(){ var $tc = $(this).find('input:checkbox:first'), tv = $tc.attr('checked'); $tc.attr('checked', !tv); }); I now would like to also have the background color change upon clicking anywhere on the DIV. For example, if they click the DIV, the checkbox would become checked AND the background of the DIV would become green. Then if clicked again, the checkbox would become unchecked and the background would go back to white. I got this far, and it does change the background to green upon clicking, but I can't figure out the part for "removing of background color". Any ideas who to accomplish that part? $("#checkbox").live('click', function(){ var $bg = $(this).css("background-color","green"); var $tc = $(this).find('input:checkbox:first'), tv = $tc.attr('checked'); $tc.attr('checked', !tv); });
  24. style3.csstesting.phpmakesend.phpstyle3.cssi really do hope to get a helpful answer. i've been working on a way to make a chatbox that allows private sessions between two users,one where only two users chat with the option of joining the general chatroom, i'm doing this without any xmpp,sockets etc, i'm just using files which would serve as logs, i'll explain the concept: a user has logged in, they are directed to the chat-page, where a list of their friends stored in a database is loaded to their right, this part is working fine: //i've declared all the variables previously //skip to the part that loads the names: while($rowb=mysql_fetch_array($done)) { $rafiki=$rowb['name']; //show the names,when the user clicks on any of them, the name(variable $jina) of the user //and the friend's name are sent to the function makefile() echo "<a href='Javascript:makefile(".$jina.",".$rafiki.")'>"."$rafiki"."</a>"."<br/>"; } when the user clicks on any name, they are sent to the javascript function, which takes both parameters, the user's name and the name of the friend, and then adds an extension at the end, to make a log file that would serve as the chat log between both of them: function makefile(username,friendname) { //add file extension var ext=".html"; //concatenate var dash="-"; var full=username.concat(dash,friendname,dash,ext); var str=friendname.concat(dash,username,dash,ext); so each pair would have their own file, the variable full is sent to a script via ajax to make the process seamless, the script does a number of things: it first checks to see if a log file, that bears the data sent from the client side exists, either beginning with the user's name or the friend's name,if either file exists,it checks to see if any messages have been sent and writes them to the file, if neither file exists, it creates a new file,and prompts a user that a friend wants to start a chat, when the friend clicks on the user's name, the first condition will succeed, because a file would already have been made: <?php session_start(); $full=$_POST['full']; //first, check to see if variations of the file already exist //start by exploding the sent data $result=explode("-",$full); $usrnme=$result[0]; $frndnme=$result[1]; $ext=$result[2]; //make varied names for comparison $vrdfull=array($result[1],$result[0],$result[2]); $str=implode("-",$vrdfull); $_SESSION['str']=$str; $_SESSION['full']=$full; //start actual comparison if(file_exists($full)||file_exists($str)) { //stuff to do if first file exists if(file_exists($full)) { //check to see if message has been sent if (isset($_POST['message'])) { $message=$_POST['message']; //update existing file with message $fp=fopen($full,'a'); fwrite($fp, "<div id=\"sent\">".$usrnme." :"." ".$message."<br/>"."</div>"); //close the file fclose($fp); } } else //stuff to do if second file exists {if(file_exists($str)) { //check to see if message has been sent if (isset($_POST['message'])) { $message=$_POST['message']; //update existing file with message $fpp=fopen($str,'a'); fwrite($fpp, "<div id=\"sent\">".$usrname." :"." ".$message."<br/>"."</div>"); //close the file fclose($fpp); } } } } else { //create file, since neither files exist $fhandel=fopen($full,'a'); //check if message has been sent if(isset($_POST['message'])) { $messssage=$_POST['message']; fwrite($fhandel,"<div id=\"sent\">".$usrname." "." : ".$messssage."<br/>"."</div>"); } fclose($fhandel); //send msg to friend, incurring them to accept $ext=".html"; $frrnme=$frndnme.$ext; $fpp=fopen($frrnme,'a'); //prompt the user to initiate chat by opening file,by clicking on the name he/she would see fwrite($fpp,"<div id=\"msg\">".$frndnme." wants to chat, click on their name to accept"."</div>"); fclose($fpp); } ?> i don't think this part has any problems, just posted it to help convey the idea across.here's the ajax that sends the string full to the script (i think it may be wrong): $.ajax({ type:'POST', url:'makesend.php', data: {full:full}, //what to do if data was sent: success: function(full){ $('#myResponse').html(full);[/font][/color] [color=#000000][font=Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif]} }); return false; no data is shown in the div "myresponse", so i think there's a problem here, i don't know what. the next thing would be to handle messages sent by the users,here's the form that would get their input: <form name="message" action=""> <input name="message" type="text" id="usermsg" size="63" /> <input name="submitmsg" type="submit" onclick="send()" id="submitmsg" value="Send" /> </form> and here's the function send() that sends data to the makesend.php file: function send(){ var clientmsg = $("#usermsg").val(); $.post("makesend.php", {message: clientmsg}); $("#usermsg").attr("value", ""); return false; } again, when i tested this and wrote a message, the page reloaded and no data was sent to the script! there's a problem here as well,i don't know what it is. moving on, after the file has been created and the user's begin interaction, it needs to be uploaded to a message area where the user can see it, here's the message area div: remember that i'll need to load a file that exists, so before loading it to this area, i'll need to use php to see which version exists, either one with the user's name first or with the friend's name (either $full or $str): $("#msgarea").html( "<?php //check to see if either file exists if(file_exists($_SESSION['full'])||file_exists($_SESSION['str'])){ //check to see if the first file exists: if(file_exists($_SESSION['full'])) { $full=$_SESSION['full']; $handlle = fopen($full, "r"); $contents = fread($handlle, filesize($full)); fclose($handlle); //load it's contents to the division if it does echo $contents;} else { //if first file doesn't exist, load the second one: $str=$_SESSION['str']; //check to see if it exists before loading it if(file_exists($str)) { $handle = fopen($str, 'r'); $contents = fread($handle, filesize($str)); fclose($handle); //load it to the division echo $contents; } } } ?>" ); i think it's legal to do that, add php code to the innerHTML of an element, so this code would load whatever version of the file that exists. i get the file names from the session because this part of the code gets executed after data is sent to the makesend.php file, which starts a session and gives them ($_SESSION['full'] and $_SESSION['str']) values. this part that loads the file is the last piece of code within the function makefile(), first, the function obtains data from the user in form of the name they clicked, it sends them to a script (makesend.php) which creates the chat log file, after this, comes the last part, which loads the data onto the division "msgarea". next, i'd need to refresh/reload the created log file after a certain amount of time to show the messages sent by the users, i chose to use 2.5 seconds, this part is outside the function makefile(),i had to use php within the jquery to first check which file exists, i'd then use jquery in the php to reload and animate(auto-scroll) the existing one,this php is inside the 'javascript' tags: <?php //set up the conditions[/font][/color] $full=$_SESSION['full']; $str=$_SESSION['str']; //check whether either file exists if(file_exists($full)||file_exists($str)) { //reload the first file if it exists if(file_exists($full)){ //this is the jquery inside the php(which is also in javascript tags) echo '<script type="text/javascript" src="jquery-1.8.0.min (1).js"></script>'; echo '<script type="text/javascript">'; echo 'function loadLog(){ var oldscrollHeight = $("#msgarea").attr("scrollHeight") - 20; $.ajax({ url: <?php session_start(); echo $_SESSION[\'full\']?>, cache: false, success: function(html){ $("#msgarea").html(html); //Insert chat log into the #msgarea div var newscrollHeight = $("#msgarea").attr("scrollHeight") - 20; if(newscrollHeight > oldscrollHeight){ $("#msgarea").animate({ scrollTop: newscrollHeight }, \'normal\'); //Autoscroll to bottom of div } }, }); } setInterval (loadLog, 2500); //Reload file every 2.5 seconds'; } else{ //this will reload the second file since the first doesn't exist: echo 'function lloadLog(){ var oldscrollHeight = $("#msgarea").attr("scrollHeight") - 20; $.ajax({ url: <?php session_start(); echo $_SESSION[\'str\']?>, cache: false, success: function(html){ $("#msgarea").html(html); //Insert chat log into the #msgarea div var newscrollHeight = $("#msgarea").attr("scrollHeight") - 20; if(newscrollHeight > oldscrollHeight){ $("#msgarea").animate({ scrollTop: newscrollHeight }, \'normal\'); //Autoscroll to bottom of div } }, }); } setInterval (lloadLog, 2500); //Reload file every 2.5 secsonds'; } echo '</script>'; } ?> and i think that's it, the entire system, also, there's a problem with the logout call, here's the code, it's at the very end of the file: $("#exit").click(function(){ var exit = confirm("Are you sure you want to end the session?"); if(exit==true){window.location = 'testing.php?logout=true';} }); here's the markup for it: <p class="logout"><a id="exit" href="#">Exit Chat</a></p> and at the top of the file, here's the part that checks whether it's set to true: session_start(); //logout function if(isset($_GET['logout'])) { if(file_exists($_SESSION['full'])||file_exists($_SESSION['str'])) { if(file_exists($_SESSION['full'])) { $full=$_SESSION['full']; $flogout=fopen($full,'a'); fwrite($flogout, $_SESSION['username']." has left the anichat!!! "."<br>"); fclose($flogout); } else { $str=$_SESSION['str']; if(file_exists($str)) { $flogoout=fopen($str,'a'); fwrite($flogoout, $_SESSION['username']." has left the chat "."<br>"); fclose($flogoout); } } } session_destroy(); header("Location:testing.php");//user redircect. } the user's page is not even refreshed so that the session is destroyed, it just refreshes and the session data is still present(this is because the login form isn't shown, it's supposed to be shown if the $_SESSION['name'] is empty). i know that this is a long question, but i am a beginner and i really need help with this, i think the main issues are with the ajax, but if you can spot anything else i will be very thankful, i kindly ask for a relevant answer that will help me implement this, if you would like me to post the entire code present in both testing.php and makesend.php,in a way that is not separated like the way i've done here to illustrate, please ask if it helps.i thank all you advanced programmers who go out of their way to help others, thanks in advance. i used phpmyadmin to set up the tables etc. i think that the ajax could be the problem any help will be highly appreciated, thanks in advance, i've attatched the relevant files.
  25. Hello in need of some help or pointers this is want im trying to archive: 1. User signs up at my website 2. user enters his ftp details into textbox 3. user then browers to folder on his server where he would like the install to begin 4. my server copys a folder that contains css, images, php files to his server 5. user can the access pre installed software i.e www.mywebsite.com/software/ how can i go about doing this?
×
×
  • 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.