Jump to content

Jason28

Members
  • Posts

    132
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

Jason28's Achievements

Member

Member (2/5)

0

Reputation

  1. I tried different only tools and tutorials about mod_rewrite but I cannot find what I am looking for. I want to rewrite a url like this (I wont include site domain since it is all within the same site directory): /area-1/(random text here)/category-5/(random text here)/ I only want it to find the area number within the slashes /area-ID/ and the category within the slashes /category-ID/ and ignore all of the other text since it changes based on the page title. I tried: RewriteRule ^area-([-0-9]+)/([^/]*)/category-([-0-9]+)\/ test.php?id=$1&var=$2&cat_id=$3 [L] The $var=2 is empty and not needed, but needed to add something there to ignore the stuff in the middle. Please help, I cannot create an account at Stackoverflow because the signup always errors. I contacted their webmaster with no reply. Thanks.
  2. Ha I figured it out myself using W3schools and only one line of code thanks for nothing screw Jquery.
  3. Hmm I doubt I need jquery for that since I have seen javascript do that years before jquery or ajax was even invented. This is not a help site? It has been helping people for years. I cannot find my answer on stackoverflow, I have been searching for hours. I work 14 hours per day at my full time job and code after that so I am far from lazy.
  4. I have spent so many years trying to figure out javascript and just cannot learn it. Especially when all of the code is correct but it doesn't work. Anyway, I need a very simple javascript code that everyone here should know please... I want to pass two values via a url, to another spot on the same webpage. So like a url with javascript function (50,60) will change the values of the an iframe on that page from <iframe style="height: 50px, width:60px">. So I will pass the height and width values to the iframe on the page when I click on a url. Please provide full code thanks
  5. Ah nevermind again I found it here this works: http://www.ozzu.com/programming-forum/ignoring-iframes-with-javascript-history-t67189.html
  6. I searched all over the internet and everyone has similar questions but not what I am looking for. Those who did get a solution only received part of the code as they assumed the person was an expert in javascript. I suck at javascript so I couldn't make it work. I have links on a webpage and when you click on the links it displays the page in an iframe. When you use the browser's back window it causes the info in the iframe to go back instead of the main page. How do I make it so that the main page goes back and not the iframe? I tried using header codes to not cache the iframe page but it doesnt work. OH and please no heavy Jquery, I imagine something simple can prevent this. Thanks.
  7. Hello, I cannot figure this out... I will leave out most of the code to not confuse you, but I have it almost working so I am just missing something. I have two arrays, one that contains the IDS that I want correctly. Here is the first array when I print it out: Array ( [0] => 3 [1] => 9 [2] => 11 ) Perfect, it displays the IDS 3, 9, and 11 like it should. Now here is my second array when printed out: Array ( [0] => name value [1] => maker value [2] => year value ) That works too. name value, maker value, and year value are the results. I tried using an array_merge on those two arrays hoping that it will turn it into 3 => 'name value', 9 => 'maker value', 11 => 'year value' For some reason the result I get when I merge these two arrays is: Array ( [0] => 3 [1] => 9 [2] => 11 [3] => name value [4] => maker value [5] => year value ) It does merge them, but as separate array values. So when I use my foreach() to insert the values into a DB, I get this as a result: INSERT INTO fields_table (field_id, field_value) VALUES ('0', '3') INSERT INTO fields_table (field_id, field_value) VALUES ('1', '9') INSERT INTO fields_table (field_id, field_value) VALUES ('2', '11') INSERT INTO fields_table (field_id, field_value) VALUES ('3', 'name value') INSERT INTO fields_table (field_id, field_value) VALUES ('4', 'maker value') INSERT INTO fields_table (field_id, field_value) VALUES ('5', 'year value') What do I do to make the first values equal the second values please? Thanks. EDIT HAHA I finally figured this out when creating this topic! I have to use array_combine() instead of array_merge it works perfect now Nevermind I solved it!
  8. Oh ok. Personally I do not mind that the comments do not work though. Well thanks a lot for all of the work you have put in this, that is the most free help I have ever received
  9. Hello, I wasn't sure if you meant replace all of the ^ or just the first one, so I tried both: '/(^|\)\s*)\s*\{(([(^|\)\s*)"\'{}]*|"([(^|\)\s*)\\\\"]+|\\\\.)*"|\'([(^|\)\s*)\\\\\']+|\\\\.)*\'|(?R))*)\}/m' No indention, and the second time I only replaced the first ^ '/(^|\)\s*)\s*\{(([^"\'{}]*|"([^\\\\"]+|\\\\.)*"|\'([^\\\\\']+|\\\\.)*\'|(?R))*)\}/m' It had a blank output. Would it be easier if I pm'ed you the whole code and the file I am trying to edit or would you rather we continue posting in this topic? Thanks
  10. Hello requinix, wow, that is some complex stuff It worked when I entered the function as a test in the field and made it work. However I tried pasting a whole file's worth of code like I did before and it resulted in a blank result. Your regex worked fine before, is it possible it can just be slightly edited to only work after detecting an end parenthesis ) or perhaps only outside of quotation marks or some other workaround? Thanks so much
  11. I tried adding a [^\)]* in there to only work after the end parenthesis and either I put it in the wrong spot or it is the wrong code since it didn't work
  12. Yes I understand that thanks. I am using this function to clean up code of old scripts that do use brackets within quotes. I just need the function requinix created to only tab when the bracket comes after an end parenthesis and then it will be complete.
  13. Sorry, I had to make another post as I can no longer edit the one above. I promise this will be the last time I bother you Yes I see it tabbed after the first bracket in the function which is why it broke. Can you make it only tab if the first curly bracket has an end parenthesis before it? Also, it seems to tab even if there is already a tab within the parenthesis. Thank you so much for your time
  14. There is something weird though. I entered your function into the post and it indented it, but for some reason it breaks its function and doesn't work when indented: function indent($code) { // first find all the sets of code blocks $formatted = preg_replace_callback('/\{ (([^{}]*|(?R))*)\}/', function($matches) { // now we're replacing them // $matches[0] is the entire code block unformatted // $matches[1] is just the code inside $innercode = $matches[1]; // apply indentation $innercode = preg_replace('/^[ \t]*\S/m', "\t\$0", $innercode); // then apply indentation to any code blocks inside this one $innercode = indent($innercode); // return. don't forget to add the {}s back return "{" . $innercode . "}"; }, $code); return $formatted; } I also just noticed a problem that I am not sure can be resolved. Some variables that are between quotations like echo "Hello {$username}"; are converted into: echo "Hello { $username}"; If I had to guess on how to fix it, I would make it only indent after it detects an end paranthesis before the first curly bracket? Like if () { } it will see the ) { or ) (next empty line) { as the trigger?
×
×
  • 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.