Current location: Hot Scripts Forums » Programming Languages » PHP » Looking for help from more PHP knowledge


Looking for help from more PHP knowledge

Reply
  #1 (permalink)  
Old 07-05-10, 10:44 PM
xavier039 xavier039 is offline
Newbie Coder
 
Join Date: Aug 2006
Posts: 56
Thanks: 0
Thanked 0 Times in 0 Posts
Looking for help from more PHP knowledge

PHP is definitely not my strong suit. I barely ever work with it but my client's site was designed in it and I am left to figure it out so I am turning for help!

Here is the homepage: ANDY SALZER

What I need to do is get the text in the project links to be called just like the how it is on the homepage.

The homepage is utilizing:

HTML Code:
<span class="quote">...</span>
For the image/text to the right.

PHP Code:

  <table border="0" cellpadding="0" cellspacing="0">

   <tr>
    <td valign="top" class="content">
    <? $c stripslashes($_GET['c']); $s stripslashes($_GET['s']);

    if(
$c == "contact") { ?>
    <img src="images/origami.jpg">

    <? } elseif($c == "services") { ?>
    <img src="images/mainlogo.png">
    <span class="services"><img src="images/services.png"></span>

    <? } elseif($c == "projects") { ?>
        <? if(file_exists($c "_" $s ".php")) { ?>
        <? include $c "_" $s ".php"?>
        <? ?>

    <? } elseif(!$s || !$c) { ?>
    <img src="images/mainlogo.png">
    <span class="quote"><img src="images/main.png"></span>

    <? } else { ?>
    <table border="0" cellpadding="0" cellspacing="0" style="width: <? if($_GET['c'] != "about") { ?>600px<? } else { ?>100%<? ?>" id="con">
    <tr>
    <td valign="top">
        <? if(file_exists($c "_" $s ".php")) { ?>
        <? include $c "_" $s ".php"?>
        <? ?>
    </td>
    </tr>
    </table>

    <? ?>
    </td>
   </tr>
  </table>

  </td>

  <? if($_GET['c'] != "about") { ?>

  <td valign="top" class="right">

    <? $c stripslashes($_GET['c']); ?>
    <? 
        
if(!file_exists($c ".php") || $c == "about") {
        print 
"&nbsp;";
        } else {
        include 
$c ".php";
        }
     
?>



  <? ?>

  </td>

 </tr>
What is currently setup is to put the text into a new table

HTML Code:
 <td valign="top" class="right">
I would really like this:

PHP Code:

<? $c stripslashes($_GET['c']); ?>

    <? 
        
if(!file_exists($c ".php") || $c == "about") {
        print 
"&nbsp;";
        } else {
        include 
$c ".php";
        }
     
?>



  <? ?>
To be called into the the:

HTML Code:
<span class="quote">...</span>
Just like it is on the homepage. Thank you so much!
Reply With Quote
  #2 (permalink)  
Old 07-07-10, 07:53 AM
elum.chaitu elum.chaitu is offline
Disabled
 
Join Date: Jul 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Spin Looking for help from more PHP knowledge

Hello xavier039,

you are given nice information. i am also trying to learn PHP. thanks for the information
Reply With Quote
  #3 (permalink)  
Old 07-07-10, 05:38 PM
Jcbones Jcbones is offline
Aspiring Coder
 
Join Date: Mar 2009
Location: North Carolina, USA
Posts: 516
Thanks: 5
Thanked 47 Times in 44 Posts
This code is horrible to read, I'm going to quote it up for you, so that you can understand it better. We can work from there.

PHP Code:

<table border="0" cellpadding="0" cellspacing="0">

   <tr>
    <td valign="top" class="content">
   <?php $c stripslashes($_GET['c']); $s stripslashes($_GET['s']); //this get's the value of "c" and "s" from the url.  Horrible sanitation, and steps need to be taken to improve this:
    /////////////Contact page/////////////////
    
if($c == "contact") { //$c = 'contact' then print the next block;
    
?> 
    <img src="images/origami.jpg">

   <?php //end printing of 'contact';
    /////////////Services page////////////////
    
elseif($c == "services") { //if $c = 'services' then print this block;
    
?> 
    <img src="images/mainlogo.png">
    <span class="services"><img src="images/services.png"></span>

   <?php //end printing of 'services';
    ////////////Projects page/////////////////
    
elseif($c == "projects") {  //if $c = 'projects' print this block;  There is no check to see if $s is set.  Also no need to close php, then open it on the next line. "removing".
         
if(file_exists($c "_" $s ".php")) { //if the file of $c-$s.php exists.
        
include $c "_" $s ".php"//include it;
         
}  //end file_exists.

     
//end 'projects';
     ///////////No page specified////////////
     
elseif(!$s || !$c) { //if there is no $c OR no $s print this block.
     
?>
    <img src="images/mainlogo.png">
    <span class="quote"><img src="images/main.png"></span>

   <?php //end printing for lack of variables.
    ///////////Failure of all above checks//////////
    
else { //if all of these checks fail, print this block.
    
?>
    <table border="0" cellpadding="0" cellspacing="0" style="width:<?php if($_GET['c'] != "about") { ?>600px<?php } else { ?>100%<?php /*if $c does NOT = 'about' set width of table to 600px, if it does, set width to 100%*/ ?>" id="con">
    <tr>
    <td valign="top">
       <?php if(file_exists($c "_" $s ".php")) { //Once again, checking for the file $c-$s.php.
         
include $c "_" $s ".php";  //Then include the file.
        
//end file exists.
        
?>
    </td>
    </tr>
    </table>

   <?php //end printing if all the checks fail.
    
?>
    </td>
   </tr>
  </table>

  </td>

 <?php ///////////Checking $c again /////////////////////
  
if($_GET['c'] != "about") { //if $_GET['c'] (which is already set to $c) does NOT = 'about', then print this block
  
?>

  <td valign="top" class="right">

   <?php $c stripslashes($_GET['c']); //Get 'c' again, this is redundant code, that can be deleted.
     
        
if(!file_exists($c ".php") || $c == "about") { //if file $c.php does not exists, OR $c = 'about' (which is won't because this block only runs if it doesn't).
        
print "&nbsp;"//print a space.
        
} else { //if $c.php does exist, or $c = 'about' (which is won't because this block only runs if it doesn't).
        
include $c ".php"//include the file $c.php
        
//end file does NOT exist.
     
   
}  //end $_GET['c'] does NOT = 'about'.
   
?>

  </td>

 </tr>
Reply With Quote
Reply

Bookmarks

Tags
html, php


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP or PHP which is better? nepala The Lounge 9 07-14-10 05:48 AM
[SOLVED] it works on localhost but not on hosting account? myslowquietlife PHP 42 12-19-08 09:31 AM
Complex mysql sorting pb (Get cat_list from cids &pcids with 1 query, willing to pay) aqw PHP 1 06-23-05 07:02 PM
PHP / Graphic Developers someotherguy582 Job Offers & Assistance 1 06-05-05 07:40 PM
100 Web Templates & 10 PHP Scripts for sale! HostersUK.co.uk General Advertisements 0 01-10-04 12:31 AM


All times are GMT -5. The time now is 08:16 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.