Jump to content

Arcalypse

Members
  • Posts

    16
  • Joined

  • Last visited

Everything posted by Arcalypse

  1. OMG, I love you! Thank you!
  2. Wouldn't it be possible to just have SQL count the number of rows in the database and then query against that value?
  3. I was looking on Google for the recursive function in the most basic form and it's enough to make my brain ache lol. With that being said, I appreciate the execution time tip. Could prove very helpful for those "server_crashing_requests" I had earlier by an accidental loop.
  4. So I am having some difficulties with a category system. I want my code to search the database an unlimited amount of times to the very last directory and then display it in tree view on my screen. I'm having some trouble because I am having to specify how many depths the code will search. How can I get it to do this on it's own? Currently my code does this... <?php // Establish SQL Connection. $mysqli = mysqli_connect( $sql['host'], $sql['user'], $sql['pass'], $sql['db'] ) or die( "DARN"); $query = $mysqli->query( "SELECT * FROM folders ORDER BY name ASC" ); $num_rows = $query->num_rows; echo "Found <b>" . $num_rows . "</b> row(s) in the database!<br>"; while ( $row = mysqli_fetch_array( $query ) ) { // DO NOT REMOVE $id = $row['id']; $name = $row['name']; $parent = $row['parent']; /***************************************************************************************************/ if ( $parent == 0 ) { echo $id . " " . $name . " " . $parent . "<br>"; $query2 = $mysqli->query( "SELECT * FROM folders WHERE parent = " . $id . " ORDER BY name ASC" ); while ( $row2 = mysqli_fetch_array( $query2 ) ) { echo " " . $row2['name'] . "<br>"; } } } ?> I know it's messy, doing the best I can. DB looks a little like this... +----+---------+--------+ | ID | NAME | PARENT | +----+---------+--------+ | 1 | Admin | 0 | | 2 | Blog | 0 | | 3 | Shop | 0 | | 4 | Forum | 0 | | 5 | Sandbox | 0 | | 6 | Config | 1 | | 7 | Login | 1 | | 8 | Display | 1 | | 9 | Lib | 2 | | 10 | Default | 8 | | 11 | JS | 9 | | 12 | CSS | 9 | | 13 | HTML | 9 | | 14 | IMG | 10 | +----+---------+--------+
  5. Well, it all depends on where the variable is being stored in PHP. For instance, if you are getting the variable via the POST method from a form. Javascript already has functions built in to get these types of variables from the URL via parsing, but you have to break it down first. It just really depends on what you are trying to do. I find that almost 80% of time, it's not necessarily if the code can DO something or not. It's really the logic behind the execution of the challenge.
  6. Is there any particular reason the 2 cannot be dependent on one another. Sorry, don't mean to be off-topic, just trying to understand the logic behind why are would make the 2 dependent in the first place.
  7. It will be very challenging to determine your issue without knowing the context, via the code itself or even a demo. I assume you mean that once you've chosen a file, the area in which is supposed to reflect the chosen file name does not show it? Does the file name area respond at all? Does the file still upload despite the lack of reaction via the file name area? Does it work when you remove the CSS? You have to think kinda like this in order to determine what the problem is exactly and then find the workaround, or just correct the issue all together.
  8. Been lurking for a small amount of time. Hoping to come here and hone my abilities. I have been dabbling with all of your basic coding languages since I was 14 and I think it's time to refine them. So from me to you, how do you do?
  9. This is true and will reign true everytime. Drupal, Joomla, Wordpress, even IPB. All of them could have books (or do) written on them just to encapsulate the power of their systems. You literally can do almost anything or find modifications to do so. With that being said, a lot of this stuff just comes with practice and time. Personally, IPB has taken me almost 5 years to figure out how to do this, or that, or work around this or that. With that being said, it is likely that your road to enlightenment, will come to fruition after some practice.
  10. You would literally have to find the variables, defines, classes, etc. from MyBB and then match them up with the page you are creating. At that rate, you might as well just create an internal page, using the admin system internally. Just my personal $0.02
  11. You're right, I should have done just an IF and ELSE statement rather than an IF and IF ELSE. I appreciate all the feedback guys.
  12. This is not the actual code I have in place right now, although I generally follow the same rule of thumb. This should have just simply been an IF and ELSE code but either way. With that being said, I just get wary when I mix the HTML, I feel like I'm doing something VERY wrong.
  13. Jacques1 thanks for the reply man!
  14. Fastsol gave a superb answer! That's exactly how I would have done it as well! I have drawn up a test page for you to fiddle around with. This test page includes several lines of code so that you can check and see how it functions at the bottom of the page. Remove these lines and it will still stick to the bottom of the page quite nicely. With that being said here's the link. http://jsfiddle.net/Y4VfZ/2/ Here is also a copy of the code... <!DOCTYPE html> <head> <meta charset="utf-8"> <title> Test Page </title> <link rel="stylesheet" href="css/main.css"> </head> <body> <div class="content"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean sed bibendum nunc. Suspendisse fringilla a nisi eu consectetur. Etiam hendrerit, tellus vel consectetur pulvinar, velit sapien imperdiet urna, in bibendum ante purus non ligula. Vestibulum venenatis leo purus, at cursus sapien rhoncus non. Duis in orci eu elit porta aliquam. Aliquam pulvinar varius imperdiet. Duis dignissim lacus augue.<br><br> Phasellus nec ultrices massa. Phasellus porta dignissim sem in convallis. Ut lorem felis, feugiat quis fermentum a, ultrices semper nisl. Phasellus ac nisi nec ante cursus sodales. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Vestibulum pulvinar facilisis ultrices. Curabitur sodales bibendum fringilla. Phasellus cursus interdum ultrices. In sed tortor eu neque accumsan vestibulum a non turpis. Nunc non scelerisque ligula.<br><br> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean sed bibendum nunc. Suspendisse fringilla a nisi eu consectetur. Etiam hendrerit, tellus vel consectetur pulvinar, velit sapien imperdiet urna, in bibendum ante purus non ligula. Vestibulum venenatis leo purus, at cursus sapien rhoncus non. Duis in orci eu elit porta aliquam. Aliquam pulvinar varius imperdiet. Duis dignissim lacus augue.<br><br> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean sed bibendum nunc. Suspendisse fringilla a nisi eu consectetur. Etiam hendrerit, tellus vel consectetur pulvinar, velit sapien imperdiet urna, in bibendum ante purus non ligula. Vestibulum venenatis leo purus, at cursus sapien rhoncus non. Duis in orci eu elit porta aliquam. Aliquam pulvinar varius imperdiet. Duis dignissim lacus augue.<br><br> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean sed bibendum nunc. Suspendisse fringilla a nisi eu consectetur. Etiam hendrerit, tellus vel consectetur pulvinar, velit sapien imperdiet urna, in bibendum ante purus non ligula. Vestibulum venenatis leo purus, at cursus sapien rhoncus non. Duis in orci eu elit porta aliquam. Aliquam pulvinar varius imperdiet. Duis dignissim lacus augue.<br><br> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean sed bibendum nunc. Suspendisse fringilla a nisi eu consectetur. Etiam hendrerit, tellus vel consectetur pulvinar, velit sapien imperdiet urna, in bibendum ante purus non ligula. Vestibulum venenatis leo purus, at cursus sapien rhoncus non. Duis in orci eu elit porta aliquam. Aliquam pulvinar varius imperdiet. Duis dignissim lacus augue.<br><br> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean sed bibendum nunc. Suspendisse fringilla a nisi eu consectetur. Etiam hendrerit, tellus vel consectetur pulvinar, velit sapien imperdiet urna, in bibendum ante purus non ligula. Vestibulum venenatis leo purus, at cursus sapien rhoncus non. Duis in orci eu elit porta aliquam. Aliquam pulvinar varius imperdiet. Duis dignissim lacus augue.<br><br> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean sed bibendum nunc. Suspendisse fringilla a nisi eu consectetur. Etiam hendrerit, tellus vel consectetur pulvinar, velit sapien imperdiet urna, in bibendum ante purus non ligula. Vestibulum venenatis leo purus, at cursus sapien rhoncus non. Duis in orci eu elit porta aliquam. Aliquam pulvinar varius imperdiet. Duis dignissim lacus augue.<br><br> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean sed bibendum nunc. Suspendisse fringilla a nisi eu consectetur. Etiam hendrerit, tellus vel consectetur pulvinar, velit sapien imperdiet urna, in bibendum ante purus non ligula. Vestibulum venenatis leo purus, at cursus sapien rhoncus non. Duis in orci eu elit porta aliquam. Aliquam pulvinar varius imperdiet. Duis dignissim lacus augue.<br><br> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean sed bibendum nunc. Suspendisse fringilla a nisi eu consectetur. Etiam hendrerit, tellus vel consectetur pulvinar, velit sapien imperdiet urna, in bibendum ante purus non ligula. Vestibulum venenatis leo purus, at cursus sapien rhoncus non. Duis in orci eu elit porta aliquam. Aliquam pulvinar varius imperdiet. Duis dignissim lacus augue.<br><br> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean sed bibendum nunc. Suspendisse fringilla a nisi eu consectetur. Etiam hendrerit, tellus vel consectetur pulvinar, velit sapien imperdiet urna, in bibendum ante purus non ligula. Vestibulum venenatis leo purus, at cursus sapien rhoncus non. Duis in orci eu elit porta aliquam. Aliquam pulvinar varius imperdiet. Duis dignissim lacus augue.<br><br> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean sed bibendum nunc. Suspendisse fringilla a nisi eu consectetur. Etiam hendrerit, tellus vel consectetur pulvinar, velit sapien imperdiet urna, in bibendum ante purus non ligula. Vestibulum venenatis leo purus, at cursus sapien rhoncus non. Duis in orci eu elit porta aliquam. Aliquam pulvinar varius imperdiet. Duis dignissim lacus augue.<br><br> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean sed bibendum nunc. Suspendisse fringilla a nisi eu consectetur. Etiam hendrerit, tellus vel consectetur pulvinar, velit sapien imperdiet urna, in bibendum ante purus non ligula. Vestibulum venenatis leo purus, at cursus sapien rhoncus non. Duis in orci eu elit porta aliquam. Aliquam pulvinar varius imperdiet. Duis dignissim lacus augue.<br><br> </div> <div class="footer"> Footer </div> </body> </html> And here is the CSS... html, body { margin: 0px; padding: 0px; font-family: Helvetica; font-size: 12px; display: table; font-size: 12px; width: 100%; height: 100%; } .content { height: auto; } .footer { background: #282828; /* Charcoal */ color: #FFFFFF; /* White */ display: table-row; height: 30px; text-align: center; line-height: 27px; }
  15. Hi guys, so I tried searching this, but I had some issues being able to find the proper wording and keywords to query. Everything I searched PHP, HTML, Coding Standard, Coding Style, Coding, Style, Standard, etc. I got varying results. With that being said, if anyone knows of a topic that already addresses this, please feel free to link it and I will gladly do the footwork. ^ TL;DR --> I searched, but couldn't find a topic for this... Alright, now down to the brass tacks... I am having some trouble building a function in PHP that will display the header. I believe (if I am not mistaken) that I have seen people warning against peppering PHP code with echo <HTML HERE> throughout your code. I can sort of understand why, but I admit I am not completely sure why this is. I am trying to figure out a way to display HTML without doing the following... <?php // -------------------------------------------------------------------------- // ADMIN BAR HANDLER // -------------------------------------------------------------------------- /** * First we need to determine if the user * is logged in or not. After determining * the user's logged in status, we will then * choose to display the admin bar or * redirect the user to the login page. */ function admin_bar() { if ( defined( USER_IS_LOGGED_IN ) ) { echo "<div class='admin_bar'> Admin Bar Here </div>"; } else if ( defined( USER_IS_NOT_LOGGED_IN ) ) { header( "Location: " . LOGIN_PAGE ) ; } } ?>
  16. I can't revise my post, but what I meant was... Depending on the way you want to do it an alternative method would be... CSS: .widgetColor { background-color: #HEXCOLOR; } HTML: <div class="widgetColor"> CONTENT HERE </div>
  17. Depending on the way you want to do it an alternative method would be... CSS: .widgetColor { background-color: #HEXCOLOR; } [/scode] HTML: [code] <div class="widgetColor"> CONTENT HERE </div>
  18. Arcalypse

    Howdy

    New here, signed up so that I could refine my newbie PHP skills. Nice to meet you all.
×
×
  • 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.