-
Posts
271 -
Joined
-
Last visited
Never
Everything posted by efficacious
-
well i'm happy for you that you got it working grats! but still no a bunch of concatenated strings in an array is not a multi dimensional array .. its a single array. What you have just made with that script above is a multidimensional array. (more than 1 index)
-
ah ok duh that makes sense.. thanks i'll give that a shot.
-
no that is not at all what a multidimensional array is.. concatenating them is just that.. a single string containing values seperated by a special character as far as the rest of the bit i can't help with atm i'm not that great with javascript myself. you seem to be on the right track tho sry i can't be of more help
-
could you show me an example of that?
-
why don't u want the "#var" in your link? You can still send information post refresh it doesn't hurt anything.. the only thing it does is maybe not look as clean in the url.. but lets be honest who gives a shit? Your users don't i'm sure. There is another option but believe me you don't wana bother.. it requires an extensive amount of javascript to track lots of variables on the page. I'm sure your users would rather have your site be fast than slow as shit and a slightly cleaner url
-
not really thats why that method was created in the first place lol
-
yes but the problem is that the client machine would be bombarded with javascript to process which will be extremely hefty if used to create animations like flash could. I would not suggest it as 90% of your users would not even be able to run it. I have seen it done though.. I have seen a website take ASCII code and animate the rooftop scene in the matrix movie with keanu reeves. It was badass but it also sucked up a shit load of resources Javascript is just as powerful as any other programming language the downside is that it pretty much only works with browser engines and 110% of the processing of the code is done on the client machine. The most common way to use it is as a cosmetic tool. Use javascript to make your site pretty and neat without bogging down your server. The General rule of thumb i guess is to only use javascript for functionality that is not absolutely neccesary for your site to work. Javascript can be turned off. If you have your site security in Javascript.. well its just been unsecured lol
-
mutli dimensional arrays? aka Array[index1][index2] maybe i'm reading it wrong but it seems to me that your concatenating your results into a single string and then placing that string into an array of others.. when in reality you should just be using multi dimensional arrays. ResultArray [sTRING1] = array('VARNAME' => 'VALUE'); ResultArray [sTRING2] = array('VARNAME' => 'VALUE');
-
Hi all, I've written a chat box via php/mysql and my only real issue with it is that I cannot get it to refresh the chat display properly. I tried adding a meta refresh to the display page that loads into the Iframe but FF has a bug in which it fails to recognize the new location of the Anchor so it screws up the autoscroll for the chat messages.. So in order to try and fix that issue I decided I should just write up a delayed javascript function to refresh the display. Here is my javascript so far: function RefreshChat() { var Display = document.getElementById('Display'); if(Display != null) { Display.src = "Chat.php&VarName=Value#Anchor"; } } The HTML bit: <iframe onload='setTimeout("RefreshChat()",9000);' src='Chat.php&VarName=Value#Anchor' name='Display' id='Display'></iframe> thats all the code except for the chat.php page..but all that page does is takes the values in and outputs the messages it does also contain the Anchor <div id='Anchor' name='Anchor'></div> Can any1 tell me why the function doesn't seem to want to fire more than one time? Even though after the first time it fires the iframe is loaded again? What it feels like to me is that the browsers keep breaking my loop
-
well i figured it was either log it in the DB or to a text file and with the DB option I can use the records to check for other users online status as well as other things.. Good tip with DELAYED modifier for the INSERT statements.. I never heard of that before. thanks.
-
I have setup a table in my DB for recording activity on the website.. the site records basic information every time a user visits a page: the id of the user, the current time, the current date, the page the user was visiting, and the users IP information. So far it seems to be working very well. But I am a bit worried that the table will become extremely cumbersome. For instance atm I am the only person who knows of the site and visits it so just from my activity on the site there is 91 records. Should I be worried about this becoming a problem when the site is open to more users? Any1 have any suggestions of a better way? Thanks for your replies.
-
wow xyph thanks that is a very nifty script.. the issue I think i have with it is that it doesn't make the changes to the searched string itself.. It finds the matches and records them but I need them removed, maybe I'm just not following it properly.. I'll continue to study it.. I do like the fact that it actually will find the names of the tag dynamically. I may need that later on. In the meantime I did find requinix's suggestion to work quite well, I'll have to stress it some more to be sure but this is solved again for now guys thanks very much!
-
I have an idea i'm going to try but it seems kinda of cumbersome.. please post if you have a better way.. My idea is to use strpos to find where each of the occurrences of the ending tags are.. record those positions in an array and then using the offeset in preg_replace to force it to remove each tag start from the last set back to the first set. I'm thinking that will get what I want accomplished.. EDIT: nevermind this won't work either.. I can't tell preg_replace where to start its search from.
-
I thought I had this cracked but I recently hit a snag with it.. it does work but only once.. if I use the "tags" more than one time than the pattern ends up catching everything from the first tag to the last tag. Do I need a subpattern or something that says not to match if there is a match within the match .. this ones got me confused.
-
how to get the name of the file including a file from the included file, This one has me mixed up a bit.. I am trying to record site activity information from a common.php file using a user object. But since the file is included into different php files based on different situations I need a dynamic way of finding the file name that is including it. I could be over complicating things but right now this seems like the best solution other wise I'll have to rewrite the code on every page i write. Is there a function for doing this? Or if someone gets what I'm trying to do if they could point me to the direction of some more information on it. Thanks.
-
nvm i figured it out.. i just needed to removed the start and end meta characters. I assume the expression is in multi-line mode and they were being considered lines instead of beginning/end markers.
-
I even tried just a simple expression and its still not working.. here is how I have it used. $string = <<<END <html> <head><title></title> </head> <body> <!-- MYTAG //--> <div id='1'> MYTAG </div> <!-- MYTAG //--> <!-- MYTAG2 //--> <div id='2'> MYTAG2 </div> <!-- MYTAG2 //--> </body> </html> END; $NewString = preg_replace("/^MYTAG$/", 'REPLACED', $string); echo($NewString); It still doesn't replace anything.. I'm not sure what I'm doing wrong..
-
Hello, I'm trying to make a regular expression pattern to find and remove code in a string of html code. I came up with this pattern but it doesn't seem to be working.. I'm using preg_replace() function and its returing untouched html. Heres my current pattern: $Pattern = '/^<!-- MYTAG \/\/-->.+<!-- MYTAG \/\/-->$/s'; I'm trying to match HTML comment tags with MYTAG inbetween them and remove the tags and all the HTML between them. <!-- MYTAG //--><html>MORE HTML CODE</html><!-- MYTAG //--> Can any1 help me with this? ~Thanks all
-
nvm I figured out the problem.. I had some stray " marks in the html that were pre-escaped and when I was programmatically escaping them it broke the code. Its all worked out now
-
I made a template class recently and the only problem I'm having with it is that when I pull the HTML through if I add double quotes anywhere it breaks the code. I understand why its breaking sorta but I can't figure out how to fix it. <html> <head> </head> <body> <p id='Element'>"Something in quotes"</p> </body> </html> $string = $template->myMethod();//Returns the html in a string eval("\$HTML = \"$string\";"); //The error happens during the evaluation here echo($HTML); The string breaks with double quotes during the eval method and I've tried replacing the " mark with \" by using str_replace but i haven't been able to get it to work. Thanks for your replies
-
i was offbase with the constants I think but after looking at the how phpbb handled their html files I made my own light weight version of it. Its working much better now.. I ended up making a template class that compiles w.e html documents previously set to a string then that string is returned and evaluated then just printed out. I have gotten it to succesfully build an HTML template with php variables and displayed with values. The value i had orginally intended to echo as a constant I changed to a regular variable. Thanks for your replies all, they were all helpful.