Jump to content

the_oliver

Members
  • Posts

    364
  • Joined

  • Last visited

    Never

Everything posted by the_oliver

  1. Hi, I have written the following procedure: DELIMITER $$ DROP PROCEDURE IF EXISTS countInstructors$$ CREATE PROCEDURE countInstructors() BEGIN DECLARE done INT DEFAULT 0; DECLARE a INT; DECLARE cur1 CURSOR FOR SELECT country_id FROM country; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; OPEN cur1; read_loop: LOOP FETCH cur1 INTO a; IF done THEN LEAVE read_loop; END IF; SELECT count(*) FROM instructors WHERE country_id = a; END LOOP; CLOSE cur1; END$$ DELIMITER ; However i only get 1 row returned. What i'm trying to do is to get a row returned for each time the query in the loop is run (SELECT count(*)...). How would i go about doing this? Or am I barking up the wrong tree? Also i get an error about the last line (DELIMITER telling me to check my syntax. Could anyone give me a pointer there too please? Many thanks, - Oliver
  2. Hello, I would like to be able to use the following to secure a 777 file a little: <FilesMatch "\.(inc|php)$"> deny from all </FilesMatch> <FilesMatch "\.(inc|htm)$"> deny from all </FilesMatch> <FilesMatch "\.(inc|html)$"> deny from all </FilesMatch> I don't want to have to put the .htaccess file in the 777 folder as it would defeat the purpose a little. How would i go about changing the FileMatch pattern to be acting on a different directory? Thank you!
  3. Hi, I need to be able to call a class based on variables. E.G. I would normally do: $action = new pattern1() but i would like to be able to do it dynamicaly: $patNum = 1; $action = new pattern.$patNum.() Im wondering if that's possible? If so what would the correct syntax be? Many Thanks.
  4. Hi, Im wondering if there is an easy way to get items out of an array returned by a function inside a class. A code example would be: class modDB { public function getPwdSalt() { $arr = array("salt", "password"); return $arr; } } ?> And what i would like to be able to do is something like: $modDB = new modDB; echo $modDB->getPwdSalt()->[1]; and just get returned 'password'. Is something like that possible? Many Thanks.
  5. Hi There, Im using preg_match and preg_replace with the following expression: /\b".$keyword."\b/i" The problem i'm having is that if $keyword was belt, although 'blackbelt' would not mach (good) and 'belt' would match '<a href="">belt</a>' would also match. What i need is for no part of '<a href="">belt</a>' to match. Any suggestions would be much appreciated! Many thanks.
  6. I've now got it working, but not in IE. Any thoughts on that people? #SideBannerAdd { color: #000; vertical-align: middle; float:right; background: #fff; position: absolute; right: -122px; top: 150px; padding-top: 2px; padding-bottom: 18px; padding-right: 15px; padding-left: 15px; -moz-border-radius: 12px; -khtml-border-radius: 12px; -webkit-border-radius: 12px; -webkit-transform: rotate(90deg); -moz-transform: rotate(90deg); filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3); } Thanks.
  7. Oh dear, back again. So I now have the div in the right place, and mostly styled. The css is: #SideBannerAdd { color: #000; float:right; background: #fff; position: relative; z-index: -1; right: 5px; height: 40px; top: 80px; -webkit-transform: rotate(90deg); -moz-transform: rotate(90deg); filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3); -moz-border-radius: 5px; -khtml-border-radius: 5px; -webkit-border-radius: 5px; } But I have two new problems. The first is that if i add more then 4 characters, the menu drops right down on the left, and the blue extends out over the right of the white box. The second is that the text is pushed up against the right of the box (the top if it was the right way up), not in the centre of it. Any more thoughts would be much apreciated. Many Thanks.
  8. Nailed it with margin: 0 auto; Thanks for your pointer seanlim!
  9. It's better now, i've rapped the whole lot in another div and given it a fixed width. Now all i need to do is align the new div centrally. Is there an easy way to do that? Thanks.
  10. Ok, so it's before <div id="canvas"> at the moment. Which puts it in a better place, but i need to lock it to the side of the white area. - Currently it's locked against the right of the browser. I also tried putting it just after <div id="canvas"> but that really messed things up. The menu dropped down a long way, and the blue extended over the right of the white. Thanks.
  11. Hi Seanlim, Thanks, thats there now, but it's just sitting bellow the area. (white 'text' at the bottom of the page). Any more thoughts? Thanks!
  12. Hello, I'm having a problem with this site: http://bit.ly/czTzhd At present everything sits nicely in the centre and stays central as the window size changes. What i'm trying to do though is to get another div (a tab) to appear on the right hand side of the central area (the white block), but leaving the current area central still. I tried warping everything thats there at the moment in a div, and then putting the tab into another div and using z-index but it would only ever appear bellow the current area. Any pointer please? Many Thanks!
  13. Hi onlyican, add_filter() is a word press hook that calls the function. It passes the content of the page being requested by a user, through the specified function. - In this case in_this_instance(). It passes the variable $data to the function, containing all the page content. The content then has to be returned, hence i am doing "return $data;" regardless of the out come. All i want to achieve with this function is to determine weather a string ($rep_val) is present in $data and, if it is, return true as "$in_this_instance". The return form the function has remain the same as what was originally passed to it. @ProjectFear. - Thanks for that, i have placed the "$in_this_instance = 'true';" above the return but the result is still not available out side the function. ($in_this_instance remains as false.) If i put an echo in just before each return, (just to debug), it shows that the "$test = strpos($ ...." bit is working. Ta!
  14. I still havant found any resion for this! Any ideas would be much appreciated!
  15. Perhaps this code makes more sense and will be more helpful! $in_this_instance = 'false'; function in_this_instance($data) { global $in_this_instance; $rep_val = '[front banner]'; $test = strpos($data, $rep_val); if ($test === false) { return $data; } else { return $data; $in_this_instance = 'true'; } } add_filter('the_content', 'in_this_instance'); echo $in_this_instance;
  16. Thanks for you replies. I should have explained that "add_filter('the_content', 'in_this_instance');" is a wordpress hook which calls the function supplying $data. It requires that at $data is the returned by the function. All I what to be able to do is alter the value of "$in_this_instance" with in the function, and then be able to retrieve the altered value outside the function. Normally i would do this with a return but as its the function is being called by the hook i can't go down this route. Hope thats a better description? Many Thanks.
  17. Hi, Im trying to pass a variable ($in_this_instance) into, and then back out of a function. The variable goes into the function no problem, and is echo'ed out fine. However the echo after the close of the function, does not give anything out. $in_this_instance = 'boo'; function in_this_instance($data) { global $in_this_instance; echo $in_this_instance; $in_this_instance = 'hoo'; $rep_val = '[front banner]'; $test = strpos($data, $rep_val); if ($test === false) { return $data; } else { return $data;; } } add_filter('the_content', 'in_this_instance'); echo $in_this_instance; Could any one give me a pointer please? Many Thanks!
  18. Hi, Im using wordpress on linux and have the standard config in my .htaccess file: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress I would like to be able to add additional non-wordpress redirects like: RewriteRule ^company$ http://www.somewhereelse.com but appending this to the file does nothing. I assume that the "RewriteRule . /index.php [L]" is over writing this? Anyone able to give me a pointer please? Many Thanks! - Oliver
  19. Hi, This cheat sheet always makes my life easier when using svn from the command line: http://www.addedbytes.com/cheat-sheets/subversion-cheat-sheet/ might be of help to you... - Oliver
  20. Hi, I have a problem with a site i'm working on at the moment. The text is all in uppercase when the site is viewed from Internet Explorer but is fine in other browsers. The site is at dev.skyemarquees.com. Could anyone please suggest where i could start looking to solve this problem? Many Thanks - Oliver
  21. Hi, I am using wordpress on a windows server and have the following in my web.config file: <configuration> <system.webServer> <rewrite> <rules> <rule name="wordpress" patternSyntax="Wildcard"> <match url="*" /> <conditions> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> </conditions> <action type="Rewrite" url="index.php" /> </rule> </rules> </rewrite> </system.webServer> </configuration> I was wondering what i would have to add to the config to apply custom url redirects? eg: to redirect /joe to /joeold Many Thanks. - Oliver
  22. Sorry, My pore code else where. The above worked fine!
  23. Hi, I have two arrays and want to remove anything that appears in the firest array, from the second array. This is the code i have: foreach ($file_array as $key => $value){ foreach ($files_to_keep_array as $ftk_key => $ftk_value){ if ($value == $ftk_value){ unset($file_array[$key]); } } } Both arrays have the correct data in, and no errors are given, but the items are not removed from the first array ($file_array). Where am i going wrong? Many Thanks. - Oliver
  24. Fantastic, getting there! Thanks for your help so far - reading through regex tutorials now! So my code reades: $problem = "<?php /**/ stuff ?>"; $contents = file_get_contents('test.txt'); $result = preg_replace("/\\b".$problem."\\b/",'',$contents); print_r($result); echo "Done"; and works fine for anything normal in $problem. However i get an: Warning: preg_replace(): Unknown modifier '*' in /Users/odh/Sites/BDRN/fix.php on line 10 I tried adding a backslash in before each of the * but it then complains about the \. Why would that be? Does it see it as part of the expression? Thanks.
  25. Ok, thanks. Im trying to strip a line of code out of all of the files on my site, that is now surplus to requirements! - A little house keeping... preg_replace looks like the way to go. Do I need to provide a regex statement for the pattern? Just proving "sdf" throughs back an error: preg_replace(): Delimiter must not be alphanumeric or backslash in /Users/odh/Sites/BDRN/fix.php Thanks.
×
×
  • 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.