Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Include file not working properly
Old 07-30-2009, 12:53 PM Include file not working properly
Junior Talker

Posts: 3
Name: ***
Trades: 0
The code for my products page works but the layout is not working on the page when load.

the page can be viewed at:
http://www.positivelymade.com/pmade-...ly-t-shirt-p1/

if you go to the following link you can see what the layout should look like at:
http://www.positivelymade.com/pmade-products

The code that is giving the problem is below:
PHP Code:
<?php
   
include $_SERVER['DOCUMENT_ROOT'].'/pm/layout.php';
   
// load the URL factory library
   
require 'includes/url_factory.inc.php';
       
   switch(
$_REQUEST['req'])  {
      case 
"view":
         
$link mysql_query("SELECT * FROM shopping_products WHERE product_id='{$_REQUEST['product_id']}' ");
         
$row mysql_fetch_assoc($link);
         
stripslashes(extract($row));
         
$page_title "Our Products: ".stripslashes($row[product_title]);
         
$long_description nl2br($long_description);    
         
pmheader($page_title);
         include 
$_SERVER['DOCUMENT_ROOT'].'/pm/html/product_large.html';
         
pmfooter();
      break;

      default:       
         
pmheader("Our Products");
         
$link mysql_query("SELECT * FROM shopping_products  WHERE (product_qty > 0)  ORDER BY product_title ");
         
         while(
$row mysql_fetch_array($link))
         {
            
stripslashes(extract($row));
            
$caption nl2br($caption);
            include 
$_SERVER['DOCUMENT_ROOT'].'/pm/html/product_small.html';
         }
         
pmfooter();
      break;
   }
?>
...All I want is for the layout of the page to WORK when I select a large product.

Last edited by wayfarer07; 07-30-2009 at 07:17 PM.. Reason: highlighted code
pm_philip is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-30-2009, 03:52 PM Re: Include file not working properly
danielsolution's Avatar
Novice Talker

Posts: 9
Name: Daniel
Trades: 0
Why do you need the $_SERVER['DOCUMENT_ROOT'] --?

Can the include not be called without it?
__________________
Daniel S.

Please login or register to view this content. Registration is FREE
Toronto
danielsolution is offline
Reply With Quote
View Public Profile
 
Old 07-30-2009, 06:59 PM Re: Include file not working properly
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
Are you getting an error message? Is the path to the layout.php file correct?

Also in my sig you'll find a link to a post about posting code on the forum. Untabbed, unhighlighted code difficult to read.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 07-30-2009, 07:24 PM Re: Include file not working properly
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,987
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
There's nothing wrong with using the DOCUMENT_ROOT as long as the paths are correct. This is something I do frequently in a similar fashion.

It looks like what is happening is that your styles are not linked to correctly. Instead of this:
HTML Code:
<link rel="stylesheet" type="text/css" href="../styles/index.css" />
Link absolutely from the base like this:
HTML Code:
<link rel="stylesheet" type="text/css" href="/styles/index.css" />
Notice all I did was remove the two dots .. Same goes for your shortcut icon.
__________________
I build web things. I work for the startup
Please login or register to view this content. Registration is FREE
.
wayfarer07 is online now
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 07-31-2009, 06:00 AM Re: Include file not working properly
Skilled Talker

Posts: 54
Trades: 0
Quote:
Originally Posted by wayfarer07 View Post
There's nothing wrong with using the DOCUMENT_ROOT as long as the paths are correct. This is something I do frequently in a similar fashion.

It looks like what is happening is that your styles are not linked to correctly. Instead of this:
HTML Code:
<link rel="stylesheet" type="text/css" href="../styles/index.css" />
Link absolutely from the base like this:
HTML Code:
<link rel="stylesheet" type="text/css" href="/styles/index.css" />
Notice all I did was remove the two dots .. Same goes for your shortcut icon.
He has that there because the styles folder is in the parent directory.

HTML Code:
(dot) = Current Directory
(dot)(dot) = Parent Directory

./style.css (Current Dir)
../style.css (Parent Dir)
../../style.css (ParentParent Dir)
Say I have a file structure similar to /root/1/2/3/4/5 with my image in /3/ but my index file in /5/

I would need to call parent directories.

HTML Code:
<img src="../../image.jpg">

(Which calls for)

<img src="/4/ .. /3/ .. image.jpg">

Last edited by KellyAX; 07-31-2009 at 06:04 AM..
KellyAX is offline
Reply With Quote
View Public Profile
 
Old 07-31-2009, 07:17 AM Re: Include file not working properly
Junior Talker

Posts: 3
Name: ***
Trades: 0
NullPoint- I am receiving no error messages.

wayfarer07- Removed the 2 dots from index.css and shortcut icon and it did nothing.

KellyAX- I changes my layout.php file to

<link rel="shortcut icon" href="../../images/pmade.ico">
<link rel="stylesheet" type="text/css" href="../../styles/index.css" />

Nothing happened

My layout.php is in the root directory & and my index.css and icon are in 2 separate folders as shown above.

Still Nothing
pm_philip is offline
Reply With Quote
View Public Profile
 
Old 07-31-2009, 08:31 AM Re: Include file not working properly
Junior Talker

Posts: 3
Name: ***
Trades: 0
It is working now, Thanks guys.. real big help
pm_philip is offline
Reply With Quote
View Public Profile
 
Old 07-31-2009, 12:17 PM Re: Include file not working properly
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,987
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
I see in your code all you did was remove the two dots as I suggested, but you said earlier that it didn't work. What was the issue?

Any path starting with "/" works its way from the root. href="/" references the homepage.
__________________
I build web things. I work for the startup
Please login or register to view this content. Registration is FREE
.
wayfarer07 is online now
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 08-06-2009, 07:00 AM Re: Include file not working properly
Average Talker

Posts: 19
Trades: 0
Hello,
I have a jsp(lets call it A.jsp) that has a second jsp(lets call it as B.jsp) included using the include directive. I have declared a variable testStr with some default value in it. But when I try to use it in B.jsp, I get the error msg that says, testStr not resolved. I'm using RSA 7.0.0.5. I've included the corresponding jsps' code below.
When I use the same jsp in any other IDE, it works without any problem. Any help is highly appreciated.
__________________

Please login or register to view this content. Registration is FREE
Hallbjörn Ólaf is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Include file not working properly
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.44665 seconds with 12 queries