Jump to content

BeeDev

Member
  • Posts

    328
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by BeeDev

  1. require_once("path/to/index-controller.php"); filemanagerAction(); Or if the filemanagerAction() function is in a class then you can call it with following without instancing the class: require_once("path/to/index-controller.php"); className::filemanagerAction();
  2. BeeDev

    Access Denied Error

    I don't think that's possible due to security issues. But you can do it the other way around, access a field in an iframe from the parent window. Using jquery you can grab such an element like this: $('#element', $('iframe').get(0).contentDocument)
  3. You can't tell your prospective client that they're cheap! Never a good idea. You can however probably approach from a different angle, saying that it's good that they already have a facebook presence up, because it means if they get a website now, and put up a link on their facebook page, and also from their new website to their facebook profile, plus having a few Tweet and Like buttons on their new website, it will help greatly towards getting good Search engine rankings (especially google). Because google stated before that the number of hits on the "Like" buttons is much much more valuable than backlinks nowadays. Social networking presence is very good for SEO. But only when it's combined with other good SEO practices ofcourse.
  4. $myArray[] = 'value1'; $myArray[] = 'value2'; This blank square bracket -> [] means add a new node into the array. It's essentially same to: $myArray[0] = 'value1'; $myArray[1] = 'value1'; it's just that you don't need to keep count, so it's perfect for use inside functions and loops.
  5. Didn't go through your whole code, but instead of using .hide() .show() you can just use .toggle() it will hide the element if it's visible, and show the element if it's hidden. More info: http://api.jquery.com/toggle/
  6. When you upload an image, you upload it to a space assigned to you in your web server's hard disk. You don't upload images into php files. Once you uploaded an image, you can just use the normal <img> html tag to put it on any page, be it html, php, asp, htm, shtml ... etc. If you want to learn these things, I suggest you start with the real basics, good place to start is w3schools.com
  7. I hope I'm understanding your problem correctly. But are you trying to create a rounded-corner-rectangle with a transparent fill, but has colors around it? It seems really hard to do it in Photoshop from what Ben is saying. If you have Fireworks however, you just select the Rounded Rectangle tool, choose "Transparent" as the fill color, choose a border color, then draw the rectangle, adjust the corners if you have to, then Flatten the image so you can fill the corners with a color with the paint bucket tool
  8. You seem to make a lot of typos... maybe it's worth running your code through the validator before posting here: http://validator.w3.org/
  9. Oh by the way didn't realise you had intentionally blocked the text with a layer. And only just noticed your logo has a <map> link around it Just wanted to mention that there's actually no right or wrong way of laying out your elements. If your margins are working then it's ok to leave it like that. You can use Margins or Absolute Positions or just use the normal flow of the block elements with floats and margins, whichever way works best for you
  10. Yea, however u need to put position:relative on your #wrapper because that div is centered on the page. Doing so will enable all the nested elements within that #wrapper to reference their absolute positions from the #wrapper div instead of the actualy <body> tag so if u put top: 0; left: 0; on your #header then your #header will stick to the left edge of your #wrapper and the top edge of your #wrapper So after doing this you can even easily convert your site. All the "margin-left: Npx" will become "left: Npx" and all the margin-top will become just top So you don't really need to change the values of the margins, just change the margin-top and margin-left into top and left.
  11. Very nice design. However some feedback would be: Your site is layed out quite badly. All the divs look like absolutely positioned, however they're positioned with Margins. You should instead use: top/left or bottom/right or other combo. And those margins sometimes block the other bits on the page. For example, all those layers of margins of the divs in the bottom actually make your link on the logo at the top quite hard to click. You have to find an actualy area that works along the edges. Also because of the same issue the text next to your photo on the homepage cannot be highlighted/selected. Was there a special reason to use Flash for the contact form at bottom? Mobile phone browsers, especially iPhones won't support that And there's no link back to your website from your blog Good luck.
  12. Something like this: <?php $xml = simplexml_load_file("xml.xml"); $found = false; foreach($xml->note as $item) { if ($item->name == "Stan") { $found = true; $info = array( "name" => (string)$item->name, "number" => (string)$item->number, "address" => (string)$item->address, "email" => (string)$item->email ); break; } } if($found){ // Item found echo "<pre>"; print_r($info); echo "</pre>"; }else{ // Item not found echo "<p>Nooooooo! I can't find itttt! SAD FACE</p>"; } ?>
  13. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <style type="text/css"> html { height:100%; } body { text-align: center; background-color: #FFFFFF; background-image: url(stand.jpg); background-position: center; background-repeat: no-repeat; margin: 0; position:relative; height:100%; } #container { text-align: left; position: absolute; top: 50%; left: 50%; margin-top: -384px; margin-left: -512px; height: 768px; width: 1024px; background:#000000; color:#FFFFFF; } </style> </head> <body> <div id="container"> <p>This is a vertically and horizontally centered div</p> </div> </body> </html> This should work. But yea as Wickham says, you shouldn't use this technique unless you're certain that your #container will fit on any size screen. But you can set certain element's dimensions depending on the user's screen size: <link rel="stylesheet" media="screen" href="../default.css" type="text/css" /> <link rel="stylesheet" media="only screen and (max-device-width: 800px)" href="../800.css" type="text/css" /> <link rel="stylesheet" media="only screen and (max-device-width: 1024px)" href="../1024.css" type="text/css" /> Within these CSS documents u can set different widths for #container. So on default.css you have the normal size for all screens, in 800.css you can put #container width and height as 600px by 400px or something, and so on ... More info: http://thomasmaier.me/blog/2010/03/04/howto-css-for-the-ipad/
  14. Error is: "document.getElementById("amaranthcups") is null" Because: Amaranth flour: <input type="text" id="amaranthflour" name="amaranthflour" /> It's not amaranthcups it's amaranthflour
  15. Try replacing line 30 that says: var servertimestring=(servermode=="server-php")? '<? print date("F d, Y H:i:s", time())?>' : (servermode=="server-ssi")? '<!--#config timefmt="%B %d, %Y %H:%M:%S"--><!--#echo var="DATE_LOCAL" -->' : '<%= Now() %>' to this: var servertimestring=(servermode=="server-php")? '<? print date("F d, Y H:i:s", time())?>' : (servermode=="server-ssi")? '<!--#config timefmt="%B %d, %Y %H:%M:%S"--><!--#echo var="DATE_LOCAL" -->' : '' It's trying to process the asp code: <%=Now()%> which is weird ...
  16. pb1uk's approach is probably easier, since you will be storing the different language text inside the <option>'s value.
  17. But the page you linked above says "test.html" Try renaming it to "test.php" and then see if it still returns invalid date.
  18. You can do this either way, easiest approach is probably javascript/jquery, but you can use PHP/MySQL or any other server-side language to populate your "different language" terms. I made a heavily commented page which you can use to get some idea how to implement this kind of thing. You can populate $languages array using php/mysql or asp/mssql <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script> <script type="text/javascript"> // Create an associative array var $languages = new Object(); // Set the array's properties $languages['en'] = 'Buy'; $languages['de'] = 'Kaufen'; $languages['fr'] = 'Acheter'; // Here comes jQuery! jQuery(function($){ // Set the elements into a variable for performance var $selector = $("#language-selector"); var $target = $("#language-target"); // This function will change the button's text function getLang(){ // Grab the selected <option> element var $selected = $("option:selected", $selector); // Only run if there's a language selected // May be an unnecessary check... if($selected.size() > 0){ // Get the selected language value var $tmpLang = $selected.val(); // Set the button's text $target.val($languages[$tmpLang]); } }; // Set event listener on $selector $selector.change(function(){ // Run getLang() if the selector changes getLang(); }); // Manually call the function so it runs // for the first time when the DOM is ready getLang(); }); </script> </head> <body> <select id="language-selector"> <option value="en" selected="selected">English</option> <option value="de">Deutsch</option> <option value="fr">French</option> </select> <input type="submit" id="language-target" value="" /> </body> </html> Good luck
  19. I don't really know good tutorials. But I could suggest one thing, which would help you keep your code organised. MVC - Model -> View -> Controller (http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller) It's a nice architecture, and a way of sorting your PHP files so you separate the display from processing. Joomla and other popular CMS's use this approach. Personally, I think if you keep all your SQL in one class, it's kinda counter-intuitive to the whole Object Oriented approach. An SQL statement for a particular object should be generated within that object, not coming from another class. But that's not really a restriction, there's nothing stopping you from doing it this way My 2cents.
  20. It's basically considered quite inefficient to use elements for styling, using selectors such as: .inner p {} .inner a {} etc. As the browsers work from right to left, so they start by taking all the P tags or A tags then for each one it looks for a parent with class .inner It's considered best practice to put a specific class on those P and A tags (just as an example, it can be div or dd or dt or whatever) and not use any selectors with descendants. Basically if there's no style that are conflicting with your current CSS statement, then you don't really need to be so specific. Instead of #main .content .inner u can just do #main .inner If there's nothing between .content and .inner then you don't need to write .content .inner p you can just do straight away .content p which will be more efficient.
  21. On the plugin's homepage: Requirement: The page running this script must either be PHP, SSI (server side includes), or ASP enabled, as the script needs to rely on one of these technologies to access your server's time.
  22. How about Absolute positions: top: 50%; left: 50%; And with negative margins: margin-left: -512px; /* Because width is 1024px; */ margin-top: -384px; /* because height is 768px; */ So: body { text-align: center; background-color: #FFFFFF; background-image: url(stand.jpg); background-position: center; background-repeat: no-repeat; margin-top: 30px; position:relative; } #container { text-align: left; position: absolute; top: 50%; left: 50%; margin-top: -384px; margin-left: -512px; height: 768px; width: 1024px; } I haven't tried/tested this but I imagine this should work in any decent browser... except Internet Explorer 6.
  23. You're on the right track, she's talking mostly about re-using classes, and fully exploiting the CSS Specificity so that you don't have to write CSS styling for many different blocks that look similar. If you think about it in object oriented view then you first declare a main class: .block { display: block; font-family: 'Arial'; font-size: 1em; } which will define properties for all elements with class 'block'. But these will be really general things that will be SAME for all elements using this class. However after this you can start getting a bit more specific (effectively 'expanding' the main class): div.block { border: 1px solid #000000; } p.block { margin: 12px 0; } span.block { float: left; } If you didn't do the above in an object oriented approach, then you'd have: div.block { border: 1px solid #000000; display: block; font-family: 'Arial'; font-size: 1em; } p.block { margin: 12px 0; display: block; font-family: 'Arial'; font-size: 1em; } span.block { float: left; display: block; font-family: 'Arial'; font-size: 1em; } Effectively increasing the size of your CSS document by repeating the same properties over and over on different scenarios. This method she's talking about is probably the best way to write CSS, however this requires a lot of planning, and also a lot of forward thinking. However you should also remember that not everybody has the luxury of time or luxury of not using !important or ID's to write this kind of "efficient" CSS. Sometimes it's best to just bung-out some inefficient CSS, rather than spending hours trying to plan what elements should have what class, and what type of specific CSS should be written etc... I'd say this kind of CSS optimization is most useful for websites that get thousands of hits per day, as each byte you save will be multiplied by thousands. If you save 1 kbyte per user on a website that gets 10 thousand hits per day then you effectively save 10 thousand kilobytes of bandwidth a day which is around 10megabytes. But if your site gets less than 100 visitors per day, you're only saving 100kb of bandwidth per day which is really insignificant. I'd say for now, don't worry about this kind of thing, just try to get CSS under your belt, so you're comfortable to hand-write any type of website using pure CSS and semantical HTML. Then you can probably start worrying about optimization etc. And also remember that CSS is only a teeny weeny part of a website, and there's a lot bigger things that you can optimize and get much better results, such as optimizing images, gzipping the scripts and css documents, setting proper caching rules etc. Good luck
  24. it's called a favicon there's lots of websites that can create these for you if you upload an image
  25. I would imagine that if you're using established CMS like Wordpress and forum software like phpBB then you should be safe from SQL Injections. It's only if you're writing your own blog software with PHP or forum software that you'd need to worry about this stuff i think ...
×
×
  • Create New...