Jump to content

AbydosGater

Members
  • Posts

    435
  • Joined

  • Last visited

    Never

Everything posted by AbydosGater

  1. This worked perfectly. I do not mind having to use the full namespace path as long as the namespace works Thank you very much salathe for such a quick reply. Andy
  2. I have a list of classes in a database that I wish to load and instanciate. I know this can be done with something along the lines of: $class = $row['name']; $instance = new $class; Ive tried the above syntax which works fine, but I am doing this with __autoload() and namespaces, so I tried the following syntax: use Plugin as foo\bar\Plugins; $class = $row['name']; $instance = new Plugin\$class; But this just throws an unexpected T_VARIABLE error. Can anyone help me out with creating new instance of a class from a string with namespaces? Thanks, Andy
  3. Hi, I guess this post is more Application Design, but the question itself regards to AJAX Design Techniques so I posted it here. I am in the initial planning stages for a community based website that I plan on developing with GWT and a PHP Backend. I was wondering if anyone could offer some architectural advice? The application will have several activities that the user can switch between, such as forums/topics or viewing/posting blogs.. ect. There will also be static modules on the page that will require to listen for updates from the server. Such as a shoutbox and a users online list. I am leaning towards using long polling, seems like a good idea. Send a request to a PHP script and POST a list of activities the user is doing such as viewing a forum, and then when something on that forum updates the PHP can return with the update. The only problem with this is what if the user changes activities after the request is made. I.E: Client sends a request to be updated about a certain forum, but then starts browsing another. I can come up with two ways around this.. 1) When the user changes activity.. kill the request and start a new one. 2) Have two requests. One long polling request waiting for updates, not sending what the user is doing. When the user changes activity, a second request to another PHP script updates the users SESSION to what they are doing, then when the long polling request gets the update in session it checks for those updates instead. Both have their advantages and disadvantages. The first one only ties up one of the 2 connection limit imposed by most browsers, but had a lot of extra network overhead with killing/resending requests. The second one involves using up both of the 2 connections from time to time. Although the second connection would not last, just update the session info. Has anyone encountered such a design problem? Could someone offer someadvice on how I should tackle this? Thanks for your time in reading. Andy (Update, just stumbled upon some more information, the 2 connection limit defined in the RFC 2068 has pretty much been ignored by some browsers such as IE and FF. So shouldnt be an issue)
  4. Hi, I have been considering making a PHP/Ajax chat room. Im wondering what is the best way of going about this? I have used many Ajax chat scripts that really are instant, but the only way I can think of going about this is by using polling. Having the Ajax check the server every 5 seconds and have PHP load any new messages. Even at 5 seconds it would put strain on the server if there were many users, but only updating messages every 5 seconds doesnt seem very efficient. Most ajax chat scripts I have used are instant, as if they are event based like normal IM Clients. How can this be achieved with Ajax and PHP? Andyyy
  5. Yeah I had this, Only issue was I was using xHTML markup, <div class="overlay" /> Without declaring the DOCTYPE. Firefox was assuming I wanted the div to wrap my content wrapper which was throwing everything off. Got it working now
  6. Yeah I have got this far, For example I have added such a div to this page: http://reconnetworks.net/RN_Design/index.html It doesnt look the best, not sure why. But either way it works. The divs opacity is 0.1 and it overs the whole page. The only issue is that users can still click the menu links and interact with the page in the background, Do you know how I can change this? Thanks, Andyyy
  7. Hi, The best way I can explain this is to just show you. If you go to this site, http://www.extjs.com/examples/explorer.html#messagebox , (I know its an Ajax framework) and click on any of the buttons (Confirm, Prompt). When you click the button, a dialog box pops up, But the rest of the page fades out and cant be interacted with. This is to bring the users focus onto the dialog box. Now, I know to get the fade effect I have to: 1) add a div to the body tag 2) set its background to black 3) set its opacity to 0.1 4) set its z-index to something like 1000 What I dont understand is how to make it so that the user cannot interact with the other controls on the page. As long as the dialog is showing, the user cannot interact with the rest of the page hidden behind it. But if I add this to my own HTML page. Just a div with width/height 100% and background/opacity black/0.1.. The user can still click buttons or edit textboxes on the page? Does anyone know how is this achieved? Thanks, Andyyy
  8. Hi napsterdj, Perhaps you could take another approach to your database table design, you could do it with only using one table. table_messages MID | FromEmail | ToEmail | Body | ShowInInbox | ShowInSentBox Using the same design idea as you already have, just include an extra two columns in your database table, one for if the messages should show in the Inbox of the ToEmail user (ShowInInbox) and one for if the message should show in the Sent Box of the "FromEmail" user. So if I sent you a message, you insert it into the database with both ShowInInbox and ShowInSentBox set to 1, but then you read and delete the message from your inbox, so when it is deleted set the ShowInInbox to 0 for the MID. Then all you have to do is add an IF statement to your PHP for the inbox and sentbox code that only displays messages that should be in the related inbox/sent box. Does that make sense? Andy
  9. Hi, I Hope I do have the right section for this! I am currently working on a GWT Based AJAX Application with a PHP/MySQL backend. One of the features I wish to add to my application is a forum for the users. My query is to how forum systems such as phpBB, SMF, or vB implement the "unread topics/posts" feature. EG: When I visit this forum and open a board such as this Application Design section, the forum knows which topics I have or have not read. I was wondering how this was implemented? The first thing that came to my mind was that every time a user opened a topic, a row was inserted into a db table that recorded the users id and topic id that could be checked against later. But surely having a list of every topic the user has viewed and checking against it is a very unefficient method? Is there another way to accomplish such a task? Also, what would happen if a change was made to a topic, such as a new post? Would the forum need to loop through every record of every users visit to a topic and if the user has visited this topic remove the record so that it appears as unread to the user? Any advice? Thanks, Andy
  10. Hi, im currently working on a small shopping cart script. I cant seem to work out the logic for a form that will allow the users to edit their cart items. I have a form that loops through all of the items they have added to their cart and shows them with a quantity textbox for the user to change selected quantity. The thing is, the user could have any amount of items listed, and each form item is named "quantity". So when the form is submitted i only get one $_POST['quantity']; for whatever the last product in the form is. I was wondering if someone could help me with the logic behind displaying a unknown number of form elements and then looping through them for processing?
  11. Hey ive been working on a script for a friend and he is using divs.. havnt worked with HTML and CSS in ages.. so used to tables. I have a div for main content.. and within that div there are other divs for menus and such. But if the divs for the menus are larger then the parent div they just draw out of it and down the page leaving the other div behind? How could i set it so that the main container div keeps drawing down the page with its content? Thanks, Andy.
  12. Hey guys. I have been asked to help out on a project for a site that needs to handle credit card payments directly.. not via paypal. I have done a few searches on google for pre-made systems and have found one or two. But i was just wondering if any of you guys have used a PHP site to handle credit card payments/transactions. If so could you tell me how you went about it? Thanks for your time in reading. Andy
  13. Ah great guys. Thank you so much. Ill take both of the code and advice above and get coding Thank you Andy
  14. Anyone any ideas that could point me in the right direction?
  15. Hey Guys, Long time since i have done any php. Just have to write a little script that opens a file and takes some values. There is an application that i use, it stores its Data in its own files, They are formatted like: I was wondering if someone could please point me in the right direction on sorting this data into associative arrays please? Any help would be greatly appriciated.
  16. Whoot thank you !!1!!one That worked Also removing the - from -/ works too.. Found that after you posted. Thank you so much.
  17. Ok i have noticed. It is the "-/" in the second variable of the regular expression. ([A-Za-z0-9-/]+) See after the 9 .. -/ so that the variable may include forward slashes too. With that in there it is causing the error. But my module system is designed around parameters being sent and split by /'s Is there any other way to include /'s to be allowed? Andy
  18. Hi MadMax, Thank you very much for your reply. I tried adding the log data to the .htaccess and it only gave me an error about access rights. Not to worry though. In the error logs, It says : cannot compile regular expression '^([A-Za-z0-9]+)/([A-Za-z0-9-/]+)/?$'\n Now after removing them one at a time i found that it is an issue with the second rewrite rule RewriteRule ^([A-Za-z0-9]+)/([A-Za-z0-9-/]+)/?$ index.php?module=$1&params=$2 Can you see what would be wrong with that regular expression?
  19. Hi, Mod_rewrite is active on my hosts server. But i get a 500 internal server error when the .htaccess is in place. I contacted my support and they said it was an error with the RegEx in the file. But it works for me on my local dev server.. and works fine on a friends server. RewriteEngine On RewriteRule ^([A-Za-z0-9]+)/?$ index.php?module=$1 RewriteRule ^([A-Za-z0-9]+)/([A-Za-z0-9-/]+)/?$ index.php?module=$1&params=$2 To me the regex looks fine to me. The only thing i can think of is that my host is apache 1.3.9 and the others are apache 2. Do you have any idea on how i could fix this to work? Any help greatly appriciated. Andy
  20. Thanks for the link, But i dont want to set a time limit on it.. I was wondering if i could have a different php script that when ran would kill the exec()'ed script? So i can end it when i want, not on a time limit. Andy
  21. Hey guys, I was to run a small script but its an infinite while loop so i cant do it in the browser. I plan on using exec() to run it.. But then if i want to stop it.. how would i stop the script? Is there a different function i could use to kill the process? Andy
  22. Yeah i was thinking about doing that, Just an easy work around, but i was still wondering why it wasnt declaring the variables global. It works with any other variable i have predefined.. Like if i declare $config as global i can echo that. But just before if i set $myVar = "test"; and global it inside the function it doesnt recognise it either. Find it odd. you say it works for you? Maybe something in the settings? Andy
  23. Hey guys, Been awhile since i have had time to do any php but this is driving me mad. I am setting two variables $comPost and $comAction.. Now if i echo these right after declaration, they work fine. But inside the displayForm() function, if i set them as global they will not echo, but if i set any other predefined variable as global they work. Code: <?php $args = explode('/', $params); $comPost = $args[0]; $comAction = $args[1]; echo "/".$comPost.":".$comAction."/"; // This echos correctly. function displayForm() { global $comPost, $comAction; echo "displayForm()"; echo "<br />"; echo "/".$comPost.":".$comAction."/"; //This doesnt show the variables? } displayForm(); ?> Anyone know why, even though the variables are global they dont work inside the function? Thanks for reading, Andy
×
×
  • 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.