Jump to content

MadLittleMods

Members
  • Posts

    46
  • Joined

  • Last visited

Contact Methods

  • AIM
    MadLittleMods@gm

Profile Information

  • Gender
    Not Telling

MadLittleMods's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. So I am wanting to replace GET variable values in a url and if the variable does not exist, then add it to the url. I am not good with javascript but I do know how to use jQuery quite well and the basics of javascript. I do know how to write regex but not how to use the javascript syntax of regex and what functions to use it with. Here is what I have so far and it does have an error on line 3: See it on jsfiddle(or below): http://jsfiddle.net/MadLittleMods/C93mD/ function addParameter(url, param, value) { var pattern = new RegExp(param + '=(.*?);', 'gi'); return url.replace(pattern, param + '=' + value + ';'); alert(url); }
  2. Since i can't just edit my existing post so my thread doesn't bump... The script does work i just didn't wait long enough for all the pages to load. Before my script spit out info as it went but now it does it all in one chunk which I was not used to.
  3. Well after my friend said "it's becuase you are defining creators inside the loop", I knew exactly what I needed to do. I was using $creators outside of its scope in the while. So i just made a variable called $done in the bigger scope and that worked great. Here is the code that works but if you remove the $done = 0 at the end then it doesn't work. How can you put a curl in a while loop and make it work? I did this about 10 days ago but now it just doesn't work.. <?php echo 'started up<br>'; $done = 1; do { echo 'doing...<br>'; $url_to_curl = "http://visualpulse.net/forums/index.php"; // create a new curl resource $ch = curl_init(); // set URL and other appropriate options curl_setopt($ch, CURLOPT_URL, $url_to_curl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // grab URL, and return output $output = curl_exec($ch); // close curl resource, and free up system resources curl_close($ch); // echo $output; echo 'just curled<br>'; // echo $output; echo '<br><br>done curling: '.$url_to_curl.'<br><br>'; // find the people preg_match_all('/<a class="subject board_title_in_info_div" href="(.*?)" name="(.*?)">(.*?)<\/a>/', $output, $creators); //print_r($creators); foreach ($creators[3] as $key => $creator) { echo $creator.'<br>'; } $done = 0; } while($done); ?>
  4. Well usually I can solve my problems after some grueling hours but this one just has me stumped. A similar script worked just 10 days ago on my server. I had just tried it today and it isnt working and that is why i made a more streamlined version hoping it would work but it did the same exact thing. I removed all the pregs and changed it to a more broad site that I know works with cURL. I made it a simpler script just for debugging and even this doesn't work. I noticed my host updated the cPanel and I think my php version is different and is now 5.2.15 All this script does is nothing i visit and the loading wheel just spins up on the tab and nothing is outputted. Here is my updated script: <?php echo 'started up<br>'; do { echo 'doing...<br>'; $url_to_curl = "http://visualpulse.net/forums/index.php"; // create a new curl resource $ch = curl_init(); // set URL and other appropriate options curl_setopt($ch, CURLOPT_URL, $url_to_curl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // grab URL, and return output $output = curl_exec($ch); // close curl resource, and free up system resources curl_close($ch); // echo $output; echo 'just curled<br>'; // echo $output; echo '<br><br>done curling: '.$url_to_curl.'<br><br>'; // find the people preg_match_all('/<a class="subject board_title_in_info_div" href="(.*?)" name="(.*?)">(.*?)<\/a>/', $output, $creators); //print_r($creators); foreach ($creators[3] as $key => $creator) { echo $creator.'<br>'; } } while(!empty($creators[3])); ?>
  5. Got it done with some Jquery -- Still some glitches but mostly works! $(document).ready(function() { var window_width = $(window).width(); var half_window_width = window_width / 2; var filler_width = half_window_width - 500; $("#cadence_header_filler").width(filler_width); $(window).resize(function() { var window_width = $(window).width(); var half_window_width = window_width / 2; var filler_width = half_window_width - 500; $("#cadence_header_filler").width(filler_width); }); });
  6. That setup doesn't seem to do much but make a worse version of what i have and yes i changed to work with my stuff... When I analyze it it kinda makes sense since your are floating left and right. I do not want my main header to the side of the screen. I want it smack dab in the middle while my left filler fills up all the space on the side if there is any. The right div really holds nothing and doesn't have any properties...
  7. Closest I can get is this: with the code of: <div class="cadence_header_holder"> <div class="cadence_header_left floatleft"></div> <div class="cadence_header_main"> </div> <div class="cadence_header_right floatleft"></div> <div class="clear"></div> </div> .cadence_header_holder { width: 100%; padding-top: 40px; padding-bottom: 40px; margin: 0 auto; } .cadence_header_main { background: url(../images/spec/cadence_header_main.png) no-repeat; width: 1000px; height: 140px; margin: 0 auto; } .cadence_header_left { width: 100%; background: url(../images/spec/cadence_header_left.png) repeat-x; height: 140px; }
  8. I want to make a header block like the image below(sorry for bad quality - big gifs mess up like that) I want the centered main div to be in the middle and then a filler div on the left to fill up the space. I have tried many things but this is just what I have at the moment. Please no absolute hacks I have this code so far: <div class="cadence_header_holder"> <div class="cadence_header_left floatleft"></div> <div class="cadence_header_main floatleft"> </div> <div class="cadence_header_right floatleft"></div> <div class="clear"></div> </div> .cadence_header_holder { width: 100%; padding-top: 40px; padding-bottom: 40px; margin: 0 auto; } .cadence_header_main { background: url(../images/spec/cadence_header_main.png) no-repeat; width: 1000px; height: 140px; margin: 0 auto; } .cadence_header_left { width: 100%; background: url(../images/spec/cadence_header_left.png) repeat-x; height: 140px; } That code aboves gives an output of:
  9. use this... while($row = mysql_fetch_array( $result )) { $i=1; if ($row['game_id']='$i') { if($row['pt_spread'] == 0) { $row['pt_spread'] = "" } echo "<tr><td>"; echo $row['date']; echo "</td><td>"; echo $row['team_name']; echo "</td><td>"; echo $row['owner']; echo "</td><td>"; echo $row['pt_spread']; echo "</td><td>"; echo $row['team_pts']; echo "</td><td>"; echo $row['team_bet']; echo "</td><td>"; echo $row['team_cover']; echo "</td><td>"; echo $row['owner_pts']; echo "</td></tr>"; if ($table_row_count % 2 && $table_row_count != 0) { echo ' <tr style="height: 8px"></tr> '; } $table_row_count++; } $i++; } echo "</table>";
  10. Well I am trying to use the mootools fx.slide to get some content to come out when a button is pushed. It is currently not working and I am really bad with java etc. I am really good with html and php. How do I get this script to work? I added the mootools library as so: <script type="text/javascript" src="scripts/mootools-core-1.3.1-full-compat.js"></script> I also put this in: <script type="text/javascript"> window.addEvent(\'domready\', function() { var status = { \'true\': \'open\', \'false\': \'close\' }; // -- vertical var myVerticalSlide = new Fx.Slide(\'vertical_slide\'); $(\'v_slidein\').addEvent(\'click\', function(event){ event.stop(); myVerticalSlide.slideIn(); }); $(\'v_slideout\').addEvent(\'click\', function(event){ event.stop(); myVerticalSlide.slideOut(); }); $(\'v_toggle\').addEvent(\'click\', function(event){ event.stop(); myVerticalSlide.toggle(); }); $(\'v_hide\').addEvent(\'click\', function(event){ event.stop(); myVerticalSlide.hide(); $(\'vertical_status\').set(\'text\', status[myVerticalSlide.open]); }); $(\'v_show\').addEvent(\'click\', function(event){ event.stop(); myVerticalSlide.show(); $(\'vertical_status\').set(\'text\', status[myVerticalSlide.open]); }); // When Vertical Slide ends its transition, we check for its status // note that complete will not affect \'hide\' and \'show\' methods myVerticalSlide.addEvent(\'complete\', function() { $(\'vertical_status\').set(\'text\', status[myVerticalSlide.open]); }); // -- horizontal var myHorizontalSlide = new Fx.Slide(\'horizontal_slide\', {mode: \'horizontal\'}); $(\'h_slidein\').addEvent(\'click\', function(event){ event.stop(); myHorizontalSlide.slideIn(); }); $(\'h_slideout\').addEvent(\'click\', function(event){ event.stop(); myHorizontalSlide.slideOut(); }); $(\'h_toggle\').addEvent(\'click\', function(event){ event.stop(); myHorizontalSlide.toggle(); }); $(\'h_hide\').addEvent(\'click\', function(event){ event.stop(); myHorizontalSlide.hide(); $(\'horizontal_status\').set(\'text\', status[myHorizontalSlide.open]); }); $(\'h_show\').addEvent(\'click\', function(event){ event.stop(); myHorizontalSlide.show(); $(\'horizontal_status\').set(\'text\', status[myHorizontalSlide.open]); }); // When Horizontal Slide ends its transition, we check for its status // note that complete will not affect \'hide\' and \'show\' methods myHorizontalSlide.addEvent(\'complete\', function() { $(\'horizontal_status\').set(\'text\', status[myHorizontalSlide.open]); }); }); </script> Then i try to implement with this: echo '<div class="profile_top_menu">'; echo ' <h3 class="section">Horizontal</h3> <div class="marginbottom"> <a id="h_slideout" href="#">slide out</a> | <a id="h_slidein" href="#">slide in</a> | <a id="h_toggle" href="#">toggle</a> | <a id="h_hide" href="#">hide</a> | <a id="h_show" href="#">show</a> | <strong>status</strong>: <span id="horizontal_status">open</span> </div> <div id="horizontal_slide"> asdfasdfasdfasdfasdf </div> ';
  11. You could rederict them and put it in a $_GET variable. for ex: http://www.phpfreaks.com/forums/index.php?song1=Christina Aguilera:Impossible; Then on the next page you could explode the $_GET['song1'] variable at the : to get the artist and song.. Just an idea.
  12. I don't reccomend using the tags because usually you can get all browsers to work but yes you can. Put the code you want to go for ie in these tags: <!--[if IE]> <![endif]--> Put the code you want to show for any other browser: <!--[if !IE]><!--> <!--<![endif]-->
  13. maybe this will help: http://www.phpfreaks.com/forums/index.php?topic=326822.0
  14. That will order your sites randomly so you can just display the first one... $amount_get = mysql_query("SELECT id FROM users"); $query = mysql_query("SELECT site_url,username,id FROM users WHERE 1 ORDER BY RAND() LIMIT 150"); $data_grab = mysql_fetch_assoc($query); echo $data_grab['site_url']."<input type='submit'>"; }
  15. try... if(preg_match('/(\s]{0,})/', $thing_to_check)) { // GIVE THEM AN ERROR }
×
×
  • 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.