Jump to content

ShibSta

Members
  • Posts

    112
  • Joined

  • Last visited

    Never

Everything posted by ShibSta

  1. Try adding padding to the containers instead of margins to each individual element. For example, add padding:85px 0 0; to #content and remove the margin from the left/right content boxes.
  2. 1) Simple, because both forms are using the class delform which says to clear: left; float: left. 2) Related to #1, both forms are not using the delform class. 3) Which version of IE are we talking about?
  3. On older browsers, the hover will only work on <a> tags. You can use JavaScript to change the style though. If you are talking about newer browser versions, I suggest you provide a link to a test page where the problem occurs and specify the browser name(s) and version number(s) that are not rendering as expected.
  4. I think you're confused, that code should have been placed in DB.php within the user_login() function. In Register.php, you can use: $sql = mysql_query("SELECT `username` FROM `usersystem` WHERE `username` = '".$username."'");
  5. $row_uruns is not defined within menuGetir(); you're using $veri. Try: $kategoriler .= "<li><a href='index.php?MX=urundetay&kategori_id=".$veri['kategori_id']."'>".$veri['baslik']."</a>\n";
  6. Your query within' user_login is trying to match two strings instead of the value of your variables. Try: $sql = mysql_query("SELECT * FROM `usersystem` WHERE `username` = '".$username."' AND `password` = '".$password."' LIMIT 1");
  7. You'll need to add a conditional within' your loop if( empty( $var ) && $var != 0 )
  8. Try this: $kategoriler .= "<li><a href='index.php?MX=urundetay&kategori_id=".$row_uruns['kategori_id']."'>".$veri['baslik']."</a>\n";
  9. Look at the array_keys() function in PHP.
  10. It has nothing to do with the code you posted, the code will work. Something that you did not post is causing the problem, such as a blank line (as mentioned by BlueSky).
  11. The mail function is: mail( $to, $subject, $message[, $additional_headers [, $additional_parameters ]] ); Not: mail( $to, $subject, $message, $from ); ============================================ Also, according to RFC 2822 - the format for the From address should be: $visitor <$visitormail> Not: $visitor ($visitormail) This may help you with the headers too: http://www.webmasterworld.com/forum88/13383.htm
  12. What is it doing? Does it redirect you to Yahoo! or does it echo that an error has occurred? I'm guessing that the script does in fact redirect you to Yahoo! and if you were to look through your server logs you would find that it also dispatched the email. My guess is that Google is simply blocking the email due to it's lack of proper headers. Hope this helps
  13. @rwwd, I appreciate the time you took to assist me, but you actually removed braces that were required; the code now has fatal errors. Also, you changed some of the logic that didn't need changed. On the first if/else, the else was meant to be only 1 line and not a block. I know OOP is huge and I need to learn it or I'll have quite some trouble around this time next year when I'm a computer science major. I am trying to learn the basics now and am stuck with the problem I've posted in this topic. This isn't for a website or part of a pre-existing script, I am doing this as an educational experiment, on my own time, to try and understand OOP a little better. Also, I'm running PHP 5.2.9 The problem remains and I'd appreciate it if someone could look into how I'm actually calling methods from other objects and how I'm passing objects through references; I believe that is where my problem lies. However, I do not know enough about it to resolve the issue on my own. Thanks again,
  14. @rwwd: I wasn't receiving an error so I'm not sure how there could have been an extra brace, it would have given a fatal error... Anyway, I'm on my mobile phone right now - I'll look at the changes you've made to the code hen I get home. I am completely new to writing OOP and dealing with the relationship between objects, therefore, I am open to suggestions and would love to know how you would approach it. I don't know anything about design patterns or the common practices in dealing with the ability to access one object from within another so I'd appreciate and additional tips. Thanks again
  15. Sorry, I had not slept in 32 hours at the time of posting this - I kinda forgot to explain the actual problem. lol Anyway, the problem is that the "Dashboard" menu item is not added to the menu from the hook. I think it's referencing things incorrectly but I cannot find out where. The code is standalone, if you copy it into a php file and run it - you will see what it's currently doing. Currently, it outputs: Link 1 Link 2 However, it should output: Link 1 Dashboard Link 2 Thanks again.
  16. I'm not sure what I am doing wrong but I am attempting to create a hook system that I can use with modules... Could someone please take a look at the code and point me in the right direction? I've never really dealt with OOP so please be detailed in your response. There are no errors, it's just not working as expected. <?php new System(); class System { public function __construct() { $this->admin = new Admin( &$this ); } public function add_hook( $tag, $method, $class ) { $this->hooks_added[$tag][] = array( 'method' => $method, 'class' => $class ); } public function do_hook( $tag, $msg ) { if( !isset( $this->hooks_registered[$tag] ) ) $this->hooks_registered[$tag] = $msg; else $this->fatal_error( "1002." . __LINE__, "Duplicate hook tags defined." ); if( isset( $this->hooks_added[$tag] ) && is_array( $this->hooks_added[$tag] ) ) { foreach( $this->hooks_added[$tag] as $hook ) { $hook['class']->$hook['method'](); } } } public function fatal_error( $num = "Undefined", $title = "Undefined", $msg = "Undefined" ) { $html = 'Error ' . $num . ': ' . $title; echo $html; } } class Admin { public $_system; public $admin_menu = array( 0 => array( "name" => "Link 1", "params" => "a=link1" ), 5 => array( "name" => "Link 2", "params" => "a=link2" ) ); public function __construct( $_system ) { $this->_system = $_system; $this->dashboard = new Dashboard( &$_system ); $this->build_menu(); } private function build_menu() { $this->_system->do_hook( "admin_menu", "Modify the administrative menu." ); ksort( $this->admin_menu ); $html = '<ul>'; foreach( $this->admin_menu as $link ) { $html .= '<li>' . $link['name'] . '</li>'; } $html .= '</ul>'; echo $html; } public function add_menu_item( $name, $params, $sort ) { if( isset( $this->admin_menu[$sort] ) ) { $this->add_menu_item( $name, $params, (int) $sort + 1 ); } else { $this->admin_menu[$sort] = array( "name" => $name, "params" => $params ); } } } class Dashboard extends Admin { public $_system; public function __construct( $_system ) { $this->_system = $_system; $this->_system->add_hook( "admin_menu", "custom", &$this ); } public function custom() { $this->add_menu_item( "Dashboard", "a=dashboard", 0 ); } } ?> Thanks
  17. The vars passed in the query string are needed for site functionality. The only way to avoid them would be to use $_POST instead of $_GET. As far as creating short URL's, you can look into mod_rewrite but the fact that you'll still need access to those variables remains. When using $_POST, you won't be able to copy the url and send it to someone for them to see the search results. Depending upon the type of site you're building, that may be a determining factor in making a decision between GET and POST.
  18. I haven't tested it but you could try something like: for($x=0 ; $x < mysql_num_rows($myresult); $x++){ echo $row['A' . sprintf("%03d",$x)]; } However, to loop through MySQL results you could just do: while($row = $myresult) var_dump($row);
  19. Regular Expressions would have to be one of my weaker links... However, I would imagine something like this (posted below) would suffice. preg_replace('/(?<=title=\")(.*)(\"=>?)/', 'apple', $haystack); You and I both should take some time to read about the PCRE regular expression syntax.
  20. The while() is already looping through the results, you don't need another loop. Look at the in_array() function.
  21. I've been coding PHP for some time and would consider myself to be at an intermediate level. I can write code to do what I need but it's probably not the best way to do it. I rarely see any code that I am not able to read, understand, or follow. I've created modifications for everything from vBulletin, WordPress, Kayako Support Suit, Magento, and more. However, I've never really built a strong understanding around OOP. For example, let say you have the following classes: _main - db - admin - - modules - - - dashboard How would you share the db connection with the dashboard class? I've been trying to read up on Dependency Injections and Singletons but I haven't found an article that has explained it on a level that I can understand. I get a feeling that most people who use OOP in PHP have a background in Java or C++ and are much more familiar with everything. Could someone please explain this to me in simple terms or link me to an extremely well explained article that I'd be able to understand without a background in computer science? Thanks
  22. I have the following PHP code: $DB->this_query = "SELECT * FROM `categories` WHERE `cStatus` = '1' ORDER BY `cName` ASC"; if ( $DB->run_query() ) // $DB->run_query() return the number of rows. { foreach ( $DB->last_result as $row ) { $DB->this_query = "SELECT * FROM `articles` WHERE `aStatus` = 1 AND `category` = '" . $catID . "'"; if ( $DB->run_query() ) { // Add the category to the menu. } } } As you can see, I have two tables: "categories" and "articles". I am trying to build a category menu but only wish to list a category if it has 1 or more articles in that category. I could alter the database to store the number of articles in each category but I'd prefer not altering the database structure. Is there any way I could combine the queries so that I am only running 1 query instead of 20? Thanks, - ShibSta
  23. I have the HTML similar to the following: <a href="#noMatch">Link</a> <div class="title"> <a href="#1" class="noBorder">Link</a>, <a href="#2" class="">Link2</a>, <a class="" href="#3">Link3</a>, </div> I am trying to get the href and innerHTML of each link. The ultimate goal is to have an array like so: $arr = array( array( "href" => "#1", "text" => "Link" ), array( "href" => "#2", "text" => "Link2" ), array( "href" => "#3", "text" => "Link3" ) ); I've managed to match the 1st link in the div but have since then changed the code and have not been able to reproduce it. Regular Expressions are certainly my weakest point, I always get stuck on them. Thanks, in advance.
  24. After further debugging, I've realized that Thunderbird is simply crying over the fact that text/html is coming before text/plain... I swapped the two and placed the text/plain first and text/html second in the mail and now everything is working. Thanks anyway.
  25. The code is irrelevant as I've proven so in debugging.... Thunderbird doesn't like something about the email's source and I can't figure out what it is. Thanks
×
×
  • 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.