
Johns3n
Members-
Posts
72 -
Joined
-
Last visited
About Johns3n
- Birthday 07/06/1986
Profile Information
-
Gender
Male
-
Location
Denmark
Johns3n's Achievements

Member (2/5)
1
Reputation
-
<tr> <td input type="textarea" class="fieldset"><div class="tbl_lbl">FUND STRATEGY</div> <div class="tbl_input"> <input size="57" name="fund_strategy" id="fund_strategy" value="<?php echo $arrayFund[0]['fund_strategy']?></textarea> </div></td> </tr> That looks confusing as hell? Shouldn't it be more like this? <tr> <td class="fieldset"> <div class="tbl_lbl">FUND STRATEGY</div> <div class="tbl_input"> <textarea size="57" name="fund_strategy" id="fund_strategy"> <?php echo $arrayFund[0]['fund_strategy']?> </textarea> </div> </td> </tr>
-
How To Handle Xx Amount Of Slashes In A Rewritten Url.
Johns3n replied to Johns3n's topic in Apache HTTP Server
It could also even just be: example.com/page So it just uses the ?slug=page variable and the first ?path=something variable is just defined as: if(!isset($_GET['path'])){ $_GET['path'] = NULL; } in the PHP app. -
Hello PHPFreaks Been a long time since i've been here last time! (hopefully it means that i'm getting better However! I'm playing around with "new" technology the mod_rewrite for the .htaccess file. I'm writting a php app where the url has 2 parameters. example.com?path=this/is/a/path/to/this/&slug=page NOW my dilemma is that my .htaccess rules work IF there is NO / (slash) in the ?path= var (since I separate the 2 vars at a /). my question is now! (bear in mind here that i'm a ROOKIE at .htaccess rewriting) how do i go about in the .htaccess file to make it reconize that whatever comes after the last slash the $2 variable and everything is $1 - even if there is no $path defined in the url? BTW! I'm not looking for free handouts and do my coding here! I'm willing to learn here but just need pointers!! I've pasted my .htaccess file here: Options +FollowSymlinks RewriteEngine On RewriteCond %{REQUEST_URI} !=/index.php RewriteRule ^([^/.]+)/([^/.]+)/([^/.]+)/([^/.]+)$ /index.php?slug=$1&type=$2&view=$3&action=$4 [L,PT] RewriteRule ^([^/.]+)/([^/.]+)/([^/.]+)$ /index.php?slug=$1&type=$2&view=$3 [L,PT] RewriteRule ^([^/.]+)/([^/.]+)$ /index.php?path=$1&slug=$2 [L,PT] RewriteRule ^([^/.]+)$ /index.php?slug=$1 [L,PT] RewriteRule ^(.+)/$ /$1 [R=301,L] Thanks in advance
-
MySQL returns wrong number of rows from $_GET value
Johns3n replied to Johns3n's topic in MySQL Help
Solved this myself should have used mysql_num_rows($result); instead of count($result); =) -
Hi PHPfreaks.com I'm having some trouble with some code that should be straight forward! When i run following code: <?php $content->query(mysql_real_escape_string($_GET['slug'])); ?> it does the following: <?php class content { public function query($slug){ if(empty($slug)){ $slug = "forside"; } $query = sprintf("SELECT id FROM komoono_sider WHERE slug = '".$slug."'"); $result = mysql_query($query); echo count($result); } } $content = new content; ?> If the slug variable is empty it should be set to "forside" and when i set it to some values that i KNOW are in the database it all works perfectly and the count is correct! However when i set the slug variable to something i KNOW that isn't in the database it returns the wrong count it still says 1 record found when it should say 0! I think i starred myself blind at the problem, but i'm not sure! Hope you guys can help me with something that should have been straight forward EDIT: You can try it here: http://johns3n.net/none/classes/ ?slug=forside AND ?slug=underside are both in the database so there the count returned should be 1 if you use those, but using i.e ?slug=randomthing still returns 1 on the screen.
-
Hi PHPfreaks! I'm having some problems with a Jquery script that i've wrote! What it suppose to do is animate a top menu with some background positions when mouseenter() and animate some divs on mouseenter and mouseleave. It works PERFECT in every browser! Except Internet Explorer 7 and 8 (IE9 works perfect). In Internet Explorer 7 and 8 it takes forever to load and when it finally loads, none of the javascript works and the page seems sluggish and unresponsive! And my deadline for this project is coming up and i've been using way to long to try and fix this error in Internet Explorer 7 and 8! Which is now why i turn to you! for YOUR HELP! and don't make me beg, because I will, with boot licking and everything! below here is a copy pasta of the javascript that i've written! I based it of this code: $(document).ready(function() { /* -- CUFON JAVASCRIPT -- */ Cufon.replace('ul#nav li a, span.produkt_pris, span.produkt_solv_pris, span.produkt_bronze_pris'); Cufon.replace('h1, h2, h3', { textShadow: '#1371a4 0px 2px' }); /* -- JQUERY SCALE -- */ $(function() { $('#box-1, #box-2, #box-3, #box-4, #box-5, #box-6, #box-7, #box-8').bind('mouseenter', function() { /* ENLARGE CHILDREN OF $this */ $(this).children('img.produkt').stop(true, true).animate({ width: '160', height: '121' }, { queue: true, duration: 'fast' }) $(this).children('img.firma').stop(true, true).animate({ width: '130', height: '85' }, { queue: true, duration: 'fast' }) $(this).children('img.cta').stop(true, true).animate({ width: '110', height: '39', top: '218', left: '80' }, { queue: true, duration: 'fast' }) /* ENLARGE $this ON MOUSEENTER */ $(this).css("z-index", "5000000") $('#box-1, #box-2, #box-3, #box-4, #box-5, #box-6, #box-7, #box-8').not(this).stop(true, true); $(this).stop(true, true).animate({ width: '270', height: '270' }, { queue: true, duration: 'fast' }) }); $('#box-1, #box-2, #box-3, #box-4, #box-5, #box-6, #box-7, #box-8').bind('mouseleave', function() { /* SHRINK THE CHILDREN OF $this */ $(this).children('img.produkt').stop(true, true).animate({ width: '132', height: '100' }, { queue: true, duration: 'fast' }) $(this).children('img.firma').stop(true, true).animate({ width: '87', height: '57' }, { queue: true, duration: 'fast' }) $(this).children('img.cta').stop(true, true).animate({ width: '96', height: '34', top: '175', left: '102' }, { queue: true, duration: 'fast' }) /* SHRINK $this ON MOUSELEAVE */ $(this).css("z-index", "5000") $('#box-1, #box-2, #box-3, #box-4, #box-5, #box-6, #box-7, #box-8').not(this).stop(true, true); $(this).stop(true, true).animate({ width: '218', height: '218' }, { queue: true, duration: 'fast' }) }); }); /* -- JQUERY HOVER -- */ $('ul#nav li a') .css( {backgroundPosition: "0 64px"} ) .mouseenter(function(){ $(this).stop().animate( {backgroundPosition:"0 0"}, {duration:200}) }) .mouseleave(function(){ $(this).stop().animate( {backgroundPosition:"0 64px"}, {duration:200}) }); }); And yes this is the code because that makes IE 7 and 8 seem slow, because when I remove it, the site instantly loads! And thank you soooo much for the help in advance everyone!
-
This is now solved! the script I included from <script type="text/javascript" src="https://raw.github.com/razorjack/quicksand/master/jquery.quicksand.js"></script> wasn't being recognized by IE because of a mimetype mismatch! I downloaded the script myself and ran it locally instead and it worked as a charm!
-
Hi PHPfreaks.com I'm having some problems getting the Jquery Quicksand Plugin to work in Internet Explorer 7 to 9. The Plugin works flawless in all other browsers but IE seems to make it hickup! Below is the code block that I use for the quicksand plugin: <ul class="filterClients"> <li class="active"><a href="#" class="all">All</a></li> <li><a href="#" class="media">Media</a></li> <li><a href="#" class="retail">Retail</a></li> <li><a href="#" class="travel">Travel</a></li> <li><a href="#" class="sports">Sports & Health</a></li> </ul> <ul class="hover_block"> <li class="item" data-id="id-1" data-type="media"><a href="#"><img src="http://placehold.it/300x200"><br />TEST 1</a></li> <li class="item" data-id="id-2" data-type="retail sports"><a href="#"><img src="http://placehold.it/300x200">TEST 2</a></li> <li class="item" data-id="id-3" data-type="sports"><a href="#"><img src="http://placehold.it/300x200">TEST 3</a></li> <li class="item" data-id="id-4" data-type="media"><a href="#"><img src="http://placehold.it/300x200">TEST 4</a></li> <li class="item" data-id="id-5" data-type="travel"><a href="#"><img src="http://placehold.it/300x200">TEST 5</a></li> <li class="item" data-id="id-6" data-type="travel"><a href="#"><img src="http://placehold.it/300x200">TEST 6</a></li> <li class="item" data-id="id-7" data-type="media"><a href="#"><img src="http://placehold.it/300x200"><br />TEST 1</a></li> <li class="item" data-id="id-8" data-type="retail sports"><a href="#"><img src="http://placehold.it/300x200">TEST 2</a></li> <li class="item" data-id="id-9" data-type="sports"><a href="#"><img src="http://placehold.it/300x200">TEST 3</a></li> <li class="item" data-id="id-10" data-type="media sports"><a href="#"><img src="http://placehold.it/300x200">TEST 4</a></li> <li class="item" data-id="id-11" data-type="travel"><a href="#"><img src="http://placehold.it/300x200">TEST 5</a></li> <li class="item" data-id="id-12" data-type="travel retail"><a href="#"><img src="http://placehold.it/300x200">TEST 6</a></li> </ul> and here is the javascript where I initiate the plugin along with a few extras such as animate the <img> tag in the <li> tags: // ---------------- JQUERY QUICKSAND ----------------- // // REGISTER UL CLASS THAT HAS SORTABLE LI TAGS. $clientsHolder = $('ul.hover_block'); $clientsClone = $clientsHolder.clone(); // WHEN USER CLICKS ON FILTER METHODE. $('.filterClients a').click(function(e) { // PREVENT BROWSER FROM DOING IT'S STANDARD THING WHEN HASHTAG IS APPLIED. e.preventDefault(); $filterClass = $(this).attr('class'); // REMOVE ACTIVE CLASS AND APPLY IT TO CLICKED LI TAG. $('.filterClients li').removeClass('active'); $(this).parent().addClass('active'); // SORT LI TAGS BASED ON CLICKED VALUE. if($filterClass == 'all') { $filters = $clientsClone.find('li'); } else { $filters = $clientsClone.find('li[data-type~='+ $filterClass +']'); } // REPLACE UL TAG WITH CLICKED LI TAGS. $clientsHolder.quicksand($filters, { duration: 1000, easing: 'easeInOutQuad' }); }); // ---------- JQUERY MOUSEOVER & MOUSELEAVE ---------- // // ANIMATE IMG TAGS IN LI TAGS WHEN MOUSEOVER. $("ul.hover_block").delegate("li", { // DEFINE ANIMATIONS. mouseenter: function() { $(this).find('img').animate({top:'-200px'},{queue:false,duration:300}); }, mouseleave: function() { $(this).find('img').animate({top:'0px'},{queue:false,duration:300}); } }); And at the bottom of my html I have following javascripts running: <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/jquery-ui.min.js"></script> <script type="text/javascript" src="https://raw.github.com/razorjack/quicksand/master/jquery.quicksand.js"></script> <script type="text/javascript" src="javascript.js"></script> The Javascript.js file has the contents which I pasted above. Now i've been trying to fix this problem for a while now. but I think i've looked at it too much to see the problem anymore.. hope you guys can help me out! Thanks in advance
-
Solved it myself! When targeting a specific <ul> as i were, delegate() was a better option! ^^ So the solution is as it follows: <script type="text/javascript"> $("ul.hover_block").delegate("li", { mouseenter: function() { $(this).find('img').animate({top:'50px'},{queue:false,duration:500}); }, mouseleave: function() { $(this).find('img').animate({top:'0px'},{queue:false,duration:500}); } }); </script>
-
Hi PHPfreaks.com I'm having some trouble with Jquery's Hover() event! I'm currently creating a portfolio where i need a image to shift it's position, once it's hovered, for that purpose i've written this small script! <script type="text/javascript"> $("ul.hover_block li").live("hover", function() { $(this).find('img').animate ({top:'50px'},{queue:false,duration:500}); }, function() { $(this).find('img').animate ({top:'0px'},{queue:false,duration:500}); } ); </script> Now the scripts works 50% because it correctly shifts the image once it's hovered, however once mouse leaves, the image doesn't shift back, it just stays in it's hovered position! Hope you can help me! (and yes I need the live() function, because i'm running this hover() script along with a Jquery Quicksand Plugin!
-
Okay thanks for the help mate, it gave me some good insight to file structure and paths when using includes ^^ This is now solved! (once again PHPfreaks delievers!)
-
And this would work with files that i include using variables? i.e: include('menu.php?itemid=2') Because i know that include REQUIRES a absolute path to the file, when you are using URL $_GET variables
-
Yes i do, i have a config.php file which calls connection to my mySQL db and set a variety of other variables
-
And just to be a total noob here, how would i do that? Because in my book absolute URL path == Server Path