Jump to content

KingOfHeart

Members
  • Posts

    222
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

KingOfHeart's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. I understand what the functions are suppose to do. I haven't worked with it enough to just write my own script. Answer me this, do you yourself see a major fault with the script? If it's simple, just tell me please. If it's complicated..well, I'll just google for more menu scripts and just fiddle with it.
  2. I hover over the menu with my mouse, all it does is highlight the main buttons. Nothing drops down so all I see is "home", "tutorials", and "more" I don't see the rest. No CSS, no tutorial, no About us, and no contact us.. I'm still a newbie so can't really debug..all I plan on doing is changing link names, playing with the x/y, just taking it one step at a time and see how custom I can make it.
  3. I found this script online and while everything looks ok, for some reason the menu is not working. <html> <head> <title>MyMenu</title> <!--The CSS code.--> <style type="text/css" media="screen"> #mymenu { margin: 0; padding: 0; } #mymenu li { margin: 0; padding: 0; list-style: none; float: left; } #mymenu li a { display: block; margin: 0 1px 0 0; padding: 4px 10px; width: 80px; background: #bbbaaa; color: #ffffff; text-align: center; } #mymenu li a:hover { background: #aaddaa} #mymenu ul { position: absolute; visibility: hidden; margin: 0; padding: 0; background: #eeebdd; border: 1px solid #ffffff} #mymenu ul a { position: relative; display: block; margin: 0; padding: 5px 10px; width: 80px; text-align: left; background: #eeebdd; color: #000000; } #mymenu ul a:hover { background: #aaffaa; } </style> <!--The end of the CSS code.--> <!--The Javascript menu code.--> <script type="text/javascript"> //variables' declaration var timer = 0; var item = 0; //function for opening of submenu elements function openelement(num) { //checks whether there is an open submenu and makes it invisible if(item) item.style.visibility = 'hidden'; //shows the chosen submenu element item = document.getElementById(num); item.style.visibility = 'visible'; } // function for closing of submenu elements function closeelement() { //closes the open submenu elements and loads the timer with 500ms timer = window.setTimeout('if(item) item.style.visibility = 'hidden';',500); } //function for keeping the submenu loaded after the end of the 500 ms timer function keepsubmenu() { window.clearTimeout(timer); } //hides the visualized menu after clicking outside of its area and expiring of the loaded timer document.onclick = closeelement; </script> <!--END of CSS code--> </head> <body> <!--HTML code for the menu --> <ul id="mymenu"> <li><a href="http://siteground.com/">Home</a> </li> <li><a href="http://www.siteground.com/tutorials/" onmouseover="openelement('menu2')">Tutorials</a> <ul id="menu2" onmouseover="keepsubmenu()" onmouseout="closeelement()"> <a href="http://www.siteground.com/tutorials/cssbasics/index.htm">CSS</a> <a href="http://www.siteground.com/tutorials/flash/index.htm">Flash</a> </ul> </li> <li><a href="#" onmouseover="openelement('menu3')" onmouseout="closeelement()">More</a> <ul id="menu3" onmouseover="keepsubmenu()" onmouseout="closeelement()"> <a href="http://www.siteground.com/about_us.htm">About Us</a> <a href="http://www.siteground.com/contact_us.htm">Contact Us</a> </ul> </li> </ul> <div style="clear:both"></div> <!--the end of the HTML code for the menu --> </body> </html> http://king-trading.freeoda.com/TF2_quiz/trade_widow.html ---------------------------------- Also this entire fire can be turned into a javascript file, right? How do I call it in the body area?
  4. Tried different commands and nothing seemed to work as good as ../ so I guess I'll just continue using that method.
  5. You have to set it? What do I set it to? That's the command I'm looking for
  6. You sure that's it? I just used this and got an error. require $basedir . "/db.php"; but this works,, require "../db.php";
  7. If I'm in a subfolder on my site how do I call a file from the base folder? I'm in the folder "Scripts" for example and I want to call a function from the parent folder. I know you could use "../" if I remember right, but I'm looking for a php function. It would use scripts something like this... include $basefunction . "/index.php"
  8. I found something shorter and simpler. preg_match_all("/(?<!\\\\)\[img(?:\s+)width(?::\d+)?=(.*?)(?:\s+)height(?::\d+)?=(.*?)(?:\s+)src(?::\w+)?=(.*?)\]/si", $message, $matches); foreach ($matches[1] as $num) { $wid = "width=" . $num; $message = ($num > 700)? str_replace("$wid", "width=700", $message) : $message; } foreach ($matches[2] as $num2) { $hei = "height=" . $num2; $message = ($num2 > 700)? str_replace("$hei", "height=700", $message) : $message; } I decided to remove px and % but don't know how to make the bbcode work only if you use numbers. I started to use d+ but it still converted the bbcode into html. I got to go to bed now but any idea how? '/(?<!\\\\)\[img(?:\s+)width(?::\d+)?=(.*?)(?:\s+)height(?::\d+)?=(.*?)(?:\s+)src(?::\w+)?=(.*?)\]/si' => "<img width=\"\\1\" height=\"\\2\" src=\"\\3\"/>", I want to convert it to an image with the width and height < this works fine and I want to convert to plain text as < no idea how Hope all I have to do is add another symbol to the search.
  9. I don't consider myself ready to use something like this. If it becomes an issue I'll use non-preg or remove the rights for the user to use this function. Unless if you think you can work with me, I'm going to just pass. Also besides px, they're allowed to use % as well
  10. Sweet, I got the image preg to work finally....Not sure if this is how you would do it, but at least now I can use sizes if needed...I'll try to see if I can use your function '/(?<!\\\\)\[img(?::\w+)?=(.*?)\]/si' => "<img src=\"\\1\" alt=\"\\1\"/>", '/(?<!\\\\)\[img(?:\s+)width(?::\w+)?=(.*?)(?:\s+)height(?::\w+)?=(.*?)(?:\s+)src(?::\w+)?=(.*?)\]/si' => "<img width=\"\\1\" height=\"\\2\" src=\"\\3\"/>",
  11. Your actually getting one step ahead so let me state the problem. As of right now when I use it returns it as meaning plain text...it did not find this exact match. -------------- I was wondering how I shoujld go about setting limits. Haven't used too much preg yet..would I just use it like this... function bbcode2html($message) { $preg = array( '/(?<!\\\\)\[img(?::\s+)? width(?::\w+)?=(.*?)(?::\s+)? height(?::\w+)?=(.*?)(?::\s+)? src(?::\w+)?=(.*?)\]\]/si' => "<img width=\"\\1\" height=\"\2\" src=\"\\3\"/>" ); preg_replace_callback(array_keys($preg), array_values($preg), $message);// < do I call it like this??? $message = preg_replace(array_keys($preg), array_values($preg), $message); return $message; } $new = preg_replace_callback('...', function($matches) { // need the src, width, and height to work if (!isset($matches[1], $matches[2], $matches[3])) { return $matches[0]; // unchanged } list(, $width, $height, $src) = $matches; // you may want to check for a valid width and height here // eg, is there a risk that someone will use width=9999999px? if (ctype_digit($width)) { $width .= "px"; } if (ctype_digit($height)) { $height .= "px"; } return "<img src=\"" . htmlentities($src) . "\" style=\"width: {$width}; height: {$height}\" />"; }, $old); ------------------------- I think I'll create a shorter function like [test ] and make it only work if I have a space after the word test and work my way on from there
  12. The w+ worked in all the other scripts so far but none of the scripts required spacing. The w+ allowed the numbers after the equal sign if I understood correct. I know \s+ or maybe it's just \s that's used to check for spacing but not sure yet which symbols to use next to it. Guess I could/should replace the ones that require numbers with a d+ right if I only allowed numbers.. but I might also want to allow things like this "" or "" as an option.
  13. Figured the backslash part since I used it lots of times in other scripts. I understand now for the colon. Still can't get the required space so far..trying different combinations. '/(?<!\\\\)\[img(?::\s+)? width(?::\w+)?=(.*?)(?::\s+)? height(?::\w+)?=(.*?)(?::\s+)? src(?::\w+)?=(.*?)\]\]/si' => "<img width=\"\\1\" height=\"\2\" src=\"\\3\"/>",
  14. BTW, what does the :: mean?? I managed to create some new bbcodes but not 100% sure on the required 1 space thing. '/(?<!\\\\)\[img(?::\s+)width(?::\w+)?=(.*?)(?::\s+)height(?::\w+)?=(.*?)(?::\s)src(?::\w+)?=(.*?)\]\]/si' => "<img width=\"\\1\" height=\"\2\" src=\"\\3\"/>", < this should output an image with a width of 24 and a height of 40. I manged to create a bbode without the width and height so far.
  15. Love2c0de that script wouldn't make sence since I need $admin to always equal that session...ok, will change the case for session. edit: the caps made the difference..I was a little rusty
×
×
  • 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.