Jump to content

Cell0518

Members
  • Posts

    36
  • Joined

  • Last visited

    Never

About Cell0518

  • Birthday 09/14/1986

Profile Information

  • Gender
    Male
  • Location
    USA / Japan (US Navy)

Cell0518's Achievements

Member

Member (2/5)

0

Reputation

  1. Hi, I was wondering if anyone knew of any tutorials about or of a premade News CMS that uses a MySQL database? I am looking to use one in my site.  *I'm hoping I put this in the correct forum.. *  ??? Thanks, Chris
  2. Thank you for the information, especially showing the $msg = $db->query... line.  This explains something I've wondered about for a while. As far as my site, it would eventually be a news system (with image uploads and a WYSIWIG editor).  I'm looking at a modular design, similar to most forums, ie: example.com/?mod=news&act=update.  How are you able to make a single php file that references all of the data passed by $_GET?  My current page does most of this, but I'm looking to clean the code up....as a lot of the html is sprinkled in and part is just simply echoed. I'm looking at making each part of the news "CMS" modular, as you can see in the example URL, which is, as I said, similar to most news pages I've seen.. (ie * http://www.theinquirer.net/default.aspx?article=34724 * -> when default.aspx sees ?article=, it knows it is an article and it needs to lookup something in (a database?) that has the id of 34724, which is anything after ?article=.) I know that this specific forum uses semi-colons vs ampersands, but how is it all linked?  What code is helping tell that when action=post, you need to get all of the required data, and give the end-user a text box to write in and when they "submit", it goes into a database? Also, if anyone has seen any tutorials, etc that may help answer this question, please post them.  Again, I know I am asking a lot, but I feel that the best way for me to learn my php is by making something. Thanks, Chris
  3. What package did you install?  This would give us a way to see ALL of the code. Thanks, Chris
  4. Hi, this was an example, simplified to not take up too much room. :)  How does the <<<EOF .... EOF; work? (I'm taking it that anything within {} is parsed, everything else is not?) In the possiblity of using a switch, I assume the way to implement the pieces of code more effectively would be to include them from separate the files? My site would eventually be a news system (with image uploads and a WYSIWIG editor).  If you know of any tutorials that would help, I would be greatly appreciated. Thanks, Chris
  5. what is the difference? ( if ($act == "") and  if ("" == $act) ) Also, I don't want to sound stupid, but what is K&R and Allman? ( I updated the original post :) ) Thanks, Chris
  6. Hi, I have a question.  When coding a update form, I want the data to be pulled from a MySQL DB. In trying to code better and I'm looking to have a better layout for my code, so it seems less cluttered and more stuctured and possibly using a template. My current code is similar to this... [code] <?php $act = $_GET['act']; if($act == "") { $query = "GET title FROM table1"; $db->query($query) while($row = mysqli_fetch_array($result, MYSQL_ASSOC)) { echo "<html>\n<head>....Update Data"; echo "<input type=\"text\" value=\"".$row['title']."\">"; echo "<input type=\"submit\" calue=\"\">"; } } if($act == "update") { $query = "....."; if($db->query($query)) { $msg = "Successful" } else { $msg = "Unsuccessful" } echo "<html>\n<head>....Data Results.."; echo $msg; echo "</body></html>"; } ?> [/code] Is there a better way to code something like this? (as in, separating the HTML from the results...) Thanks, Chris
  7. Hi, I am looking to better organize my site's code and I'm looking at templating. I've run into a few questions: looking at my current layout (below) [b]Home Page[/b] [img]http://ftp.chrisloveonline.com/dslr-1.jpg[/img] A lot of my data is being pulled from the same database, using several MySQL queries.  Tables are being used in a lot of the overall page layout with 3 separate tables (one each for header, overall content and footer), with the center table having 3 columns (blue borders showing each). All 3 tables are consistent with the entire site (other than forum / gallery).  Most of the pages are only using the center column, with the home page being the exception.  I'm looking for a good way to clean up my code, as a lot of the html formatting for the results of the queries is just echoed. [code]for($total_number,$number,$number++) { echo "<b>".$query1_array['title']."</b>"; }[/code] I feel I must be over complicating this, as it seems like a very large task. Can someone point me in the right direction on a tutorial / example that would help me? Thanks for you time, Chris
  8. Hi, thanks for the article on the templating.  I've already read some of it and it looks very informative and very useful. Now, I'm trying to figure out how to use this in a modular aspect, as in a url that is www.example.com/admin/index.php?module=news&action=add. (this is basically how my site works now, although it's currently kinda messy as mentioned in my first post) What is interpreting the url and decifering what code needs to be pulled and processed and what is shown?  I understand that $_GET["module"] would be equal to the value in the url.  Is someone going to say [code] if ($module = "news") { code } elseif ($module = "settings") { more code } else { generic error code / menu } [/code] or is there a better way? Thanks, Chris
  9. How many of you, in coding your own CMS worked to make the PHP separate from HTML?  Does anyone have any good resources that helped them with this? I am running a news site that deals with Photography news, specifically for Digital Single Lens Reflex (D-SLR) cameras.  I am having a hard time implementing this, as I feel the html / css formatting is hard to strip from the functional PHP. For example, when designing the posting of the news, the news is (for the moment) in a generic text box.  I am coding the formatting when I write the article (including links, images, etc).  (I am wanting to eventually move to a WYSIWYG editor, like many forums use, but have yet to find a good article that shows a good cross browser method and I haven't looked into any of the pre-made ones yet, as mentioned in an earlier reply.) My current CMS code works like such... [code] <?PHP Session check (see if the user is logged in) include the "user_config" file Basic starting html (such as <html> and <head>) if ($act = "add") { if (isset($_POST["content"])) { mysql query to insert into DB if($db->query("INSERT....")  {$post_msg = "Good"} else {$post_msg = "Bad"} } if (isset($post_msg)) { code to display msg } HTML Form continuing to have an elseif for edit and a "catch all" else "clean up" display if neither is set. ?> [/code] In addition, I am expanding what I want to do with the site and I'm working to try to make the site modular. I'm beginning to see why people say the code should be separate from the design, as I feel the current code is "messy" and needs a restructuring. Your help would be greatly appreciated. Thanks, Chris
  10. Register Globals is off. 1.  you need to place $varname = $_GET["varname"] for php to look for the variable passed in the url. *( place the code before the variable is used )* Example: $product = $_GET["product"]; echo $product; 2.  Check this line -> [code]<td width="520" rowspan="3" bgcolor="#E7E7DD" valign="top"><iframe id="productmain" src="<?=$url;?>".....[/code] replace <?=$url;?> with either <? echo $url; ?> or <? print $url; ?>
  11. I know this is an odd question, but after reading some code (Gallery 2), I see: [code]GalleryCoreApi::requireOnce([/code] What does the :: between the GalleryCoreApi mean?  The Core Api is a class and I understand requireOnce, but usually it's require_once(.... is :: the same as -> ? Thanks, CL.
  12. Fixed, Thanks.  I didn't realize you needed both GET and =. Thanks.
  13. I am passing a variable through the url ($_get) example: http://www.dslr-photography.com/chk_id.php?id=3 [code] <?php //Setup $id echo "ID CHECKER<br />"; $id == $_get['id']; echo "Story ID = ".$id; ?> [/code] Why is this not working?  I am very frustrated with this simple, stupid problem.  ??? >:( :-[ I've tried $_GET, $_get, 'id', "id".
  14. Does the variable need to be: $_GET["p"] = $p; or $p = $_GET["p"]; or do both the same? Does the variable (in PHP5) usually continue to an included file?
×
×
  • 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.