Jump to content

djp1988

Members
  • Content Count

    539
  • Joined

  • Last visited

Everything posted by djp1988

  1. I have two UL lists one inside another, and the default li style is just rounded black for the first list and hollow black for the second, how can i force the child list to retain solid black dots as their style ?Thanks <ul> <li>item 1</li> <li>item 2 <ul> <li>item 2 a</li> <li>item 2b</li> </ul> </li></ul>
  2. Hello, I've been playing around with my server and just noticed an older project has stopped working, I've tracked the error down to a line in my .htaccess file. RewriteRule ^info/([0-9]+)/([0-9]+)/([0-9]+)/ getInfo.php?year=$1&month=$2&day=$3 [QSA] This throws a Forbidden error: You don't have permission to access /site/getInfo.php on this server.The curious thing is I tried changing that line to point to a html document, and there were not errors, what in my configuration could be causing this to be wrong for php files and not html files ?
  3. Hello,I've ran into the most curious of problems.I have a site set up with three floating blocks, one left menu, a right menu, and a center block for the content.The left block and center blocks float left and the right block floats right.the order in html of these blocks is: <div id="left_block"></div><div id="right_block"></div><div id="center_block"></div> What is happening is that clicking a link to a page on the site makes IE 7 display the central block down the page, as if it's clearing the float right. But here's the curious thing, if i click the browsers refresh button, the page reloads and appears correctly. Every time I do that it works, but clicking a link will make it show the central block under the right block, as if maybe it's too large for the available space...Has anyone head of this kind of behavior from IE before?
  4. Thanks for the suggestions chaps, what I've found that works well is setting the list to position absolute, and having its top to the combined heights of the above elements, and bottom set to 0, which stretched the height to fill the parents height minus the top elements
  5. I have an element with a fixed height. Inside this I have a form, a h3 element and then a ul list.The ul list has the CSS property overflow-y set to scroll. So I have a scroll bar.I would like to make the height of the list to fill up what's left of the height of the parent element. I can't set the height to 100% because it will equal the parent's height, and push out of the parents boundary as I have a form and h3 element above the list.What can I do to make the list stretch only to the available space left in the parent element ?
  6. djp1988

    Resize window

    Hi guys, I'm working on a IM chat system, I've got a page devoted to it, so it's sort of like a pop up but I'm trying to avoid using a pop up window because the user may have a setting blocking pop ups.So what I've done so far is open a new page in a new window and I'm using window.resize(w, h) to resize the window to my desired size.But this as the method states, resizes the window, and so takes into account menu bars/ status bars etc which I cannot account for.So has anyone ran into this problem and have a work around, or should I just revert to a traditional pop up from which I can control these parameters.Your ideas will be interesting,Thanks.
  7. djp1988

    Encoding video

    Hello guys !I need to encode video uploads sent to my server to make them .flvI have been doing research for a few days and haven't found anything of much help, a lot of reading about ffmpeg and it's php extension etc...I even got as far as finding a script that converts videos, but it's using something called flvtool2 which requires Ruby.Is there a PHP only solution to this and if so, or if not, what should I be doing? I've tried all sorts but I'm getting very frustrated now, so hopefully someone can give me hope !Thanks,Daniel
  8. I need to have a pop up window, and I'm going to be doing some stuff in that, and hopefully setting some session variables in php within that window, but when I'm done, I need the main window to refresh to take into account the new session variables, can I do this ?
  9. djp1988

    array_map on objects

    I have an array of objects, each object has an id property. I need to get an object from the array based on the id property.using array_map, I usually do the following: $looking_for_object_id = 3;$ids = array_map(create_function('$a','return $a->id;'),$my_array);$key = array_search($looking_for_object_id, $ids);if($key !== false){$my_obj = $my_array[$key];} How could I simplify this ? I would have prefered doing something like: $my_obj = array_map(create_function('$a','if($the_id == $a->id) return $a;'),$my_array); but obviously I get an error because $the_id is from outside the function
  10. djp1988

    php security

    if you don't use strip_tags then someone one could insert malicious code into your page, for example, someone could add a script tag and import an external javascript file that might gather cookie information from the user.Sometimes you want to allow basic formatting, and let your user feel more advanced if he/she wishes to, so you can allow certain tags for example the following code would strip all tags except the strong and em tags. $txt = strip_tags($input, '<strong><em>'); If by the following quote you meant you want to allow users to type code and for that code to be displayed and not become part of the actual HTML, then you should look at PHP's htmlspecialchars function
  11. djp1988

    PHP DOM

    Ah great thanks, that does the trick.
  12. djp1988

    PHP DOM

    Hi,It seems it is outputting <br /> but in Safari's web inspector is was showing the following:But in the source code if I look at the raw code it show me:But this now prompts another question, I only want the ul node and it's children, why have I got the <?xml version="1.0"?> tag ? Can I just get the ul node from my code ?My code is: if(count($submenu_items) > 0){ $dom = new DOMDocument(); $ul_list = $dom->createElement('ul'); foreach($submenu_items as $b){ $li = $dom->createElement('li'); $a = $dom->createElement('a'); $a->setAttribute('href',$b['link']); $a->appendChild($dom->createTextNode($b['name'])); $li->appendChild($a); $br = $dom->createElement('br'); $li->appendChild($br); $ul_list->appendChild($li); } $dom->appendChild($ul_list); $submenu_markup = $dom->saveXML(); }
  13. djp1988

    PHP DOM

    But I have a br element tag in my DOM, which is empty, when I call saveXML() the output is <br> and not <br /> this is the problem I'm trying to see how I can fix.
  14. djp1988

    PHP DOM

    So to tie things up the comment made in this blog post towards the end of the article concerning self-closing tags is actually nonsense ?http://www.ultramegatech.com/blog/2009/07/...ocument-in-php/
  15. djp1988

    PHP DOM

    I thought DOMDocument produced an entire tree node, I've just realised that my output for it is actually only the fragment I wanted, XMLWriter looks quite good, but I am unsure about all the endElement() calls I need to make, that's becoming similar in a way to manually appending html to a string.I did find a class someone wrote for this exact problem, here's the link to that. http://davidwalsh.name/create-html-element...mlelement-classI think I will just stick to DOMDocument, for a moment I though of DOM-enizing the class on the link and naming that class DOM, that would have felt quite native !One issue I am having with DOMDocument is that it doesn't seem to be applying correct output for self-closing tags. I am trying saveXML() and saveHTML()I find this strange because a blog post I saw specifically said to use saveXML() to get self-closing tags, maybe I'm not getting this because I'm not creating an entire DOM tree of elements ? And therefore the saveXML() method doesn't have any DTD to go on ?
  16. djp1988

    PHP DOM

    I know DOMDocument allows PHP to create the entire tree of elements in the document object model, however is there any other classes I can use to create elements on the fly, basically I'm getting frustrated with some of my code like : $markup = '<ul>';foreach($a as $b){ $markup .= '<li>'.$b.'</li>';}$markup .= '</ul>'; I'd much rather do something like this if possible: $dom = new SOMETHING();$ul_list = $dom->createElement('ul');foreach($a as $b){ $new_li = $dom->createElement('li'); $new_li->appendChild($dom->createTextNode($b)); $ul_list->appendChild($new_li);}echo $ul_list;
  17. djp1988

    PHP file upload

    Okay maybe I'm not logging to the correct file ? I specified an error log in my vhosts.conf file which does show apache errors, but maybe not php errors ? Although when I execute error_log() in PHP I do see output in the same log, I am checking that and it holds no clues
  18. djp1988

    PHP file upload

    Forgetting javascript, my browser shows the loading bar stuck at half way and the loading image spinning round
  19. djp1988

    PHP file upload

    Hi, yea I've looked in the logs and when I say the script doesn't stop, what I mean is the http request for that page is actually in a state of loading for over 5 minutes, well until i close that window actually. So it looks like the PHP ran out of memory and couldn't finish up and for some reason the http connection to that request stayed alive during this time.This and the mail() function are the two things I find unreliable in PHP...
  20. djp1988

    PHP file upload

    I have an image upload form on my site, I'm testing it on my localhost, for some images, when I submit the form, the request just never ends, and no file gets added to the specified directory.This wouldn't usually surprise me but the file I'm dealing with is actually only 98KB and is 600x400 pixels, I looked at my -max_execution_time-max_input_time-memory_limitIn php.ini and their values were 30, 60, 128MB respectively (i presume this is the default). So I doubled each value and on first attempt my upload worked, but what I can't understand is why did the upload "sometimes" work ? Maybe I need to use flush() to free up memory before my upload ?And some files seem to have an upload success rate higher then others, the latter only uploaded twice on at least 10 attempts.I'm posting the upload form to an iframe, and using javascript to show an ajax-type loader icon, there's nothing more frustrating then that never changing because the PHP script (which outputs a parent.upload_finished() javascript statement) never actually loads.I could use some pointers on uploads and memory with php, can anyone help ?
  21. I am having trouble finding anything on google about an api I could use to find towns / cities, I need to validate a town/city name from a user input in order to search my site for events at that city/town.Is this functionality build into the maps api maybe ? Because I'm looking for it as a stand alone api, maybe I shouldn't be ?
  22. djp1988

    Error screens

    Hello to all,I have been a web developer for some time now, and one thing I always cringe in my web developments is how I manage error screens, being the developer, I know that if for example I navigate to a certain url, I can see an error message I put there, but it's not relevant because it's not a follow up to a real error.Say for example I try to send a message to someone, so on my site I have an inbox, a sent box and a create new message page, if I make my message and submit, the form gets processed, if among my PHP process there's something wrong, like a row didn't get entered into the database, I want to then tell the user something went wrong.I like to keep the PHP processing logic away from the web pages so what I might do is send the form to a handle_message.php page and that then does the magic and then redirects to the relevant page after.I do this to avoid someone refreshing and submitting a form again.But when an error occurs I find myself sometimes redirecting to a url such as: http://domain.com/messages.php?error=1And then I'd display a message, thats all fine if there was a message, but now I don't feel I'm managing this in the best way because I could just manually goto this url and see some message I shouldn't see...That's just an example, I know I can submit to the same page and handle error along with the post / get data, but I really wanted to avoid the user being able to resubmit a form.How do you manage these kinds of situations ?Thanks
  23. djp1988

    CURL problem

    Hi, I am using a script that uses CURL, when I tested it on the live server I'm getting this error: CURLOPT_FOLLOWLOCATION cannot be activated when safe_mode is enabled or an open_basedir is set What should I do ? I've enabled safe_mode, and still have the error, what is open_basedir ? I have set my include path to an absolute path if that could be the problem...
  24. djp1988

    SVN problem

    Hello all,I have a problem with SVN, I have a repository set up on my web server, and I can check out a copy to my machine, but I can't seem to be able to checkout a copy to somewhere else on the same server.When I type the command to checkout (onto the directory of the live site - same server), I get the following error:svn checkout http://svn.domain.comsvn: PROPFIND request failed on '/'svn: PROPFIND of '/': 405 Method Not Allowed (http://svn.domain.com)This only happens if I try to checkout onto the same server as the svn, I can and have already checked out on my Macbook.What could be wrong ?
  25. Hello all.I am working on a project at the moment which has to be hosted on a plesk hosting system, so with this system I've been having problems, because when I create a new domain, I get an allocation of part of the server with a httpdocs directory set up to be the root directory, other directories which are not web accessible include a config directory and some other familiar folders.My problem is, when I work on projects on my localhost, I have a root directory which contains a php classes directory for all my php stuff, some other folders for configuration assets, and a www folder which acts as the root directory.When I use plesk I can't seem to modify the server to either allow me to add content to he non web accessible part of the server (due to permissions), or make my httpdocs dir root but a www dir inside of this the web root of the domain.How would you suggest I keep my php classes non web accessible ?Thanks,Daniel
×
×
  • Create New...