SitePoint Sponsor |
|
User Tag List
Results 1 to 9 of 9
Thread: Why won't this print?
-
Mar 2, 2006, 10:01 #1
- Join Date
- Mar 2003
- Location
- Flanders
- Posts
- 523
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Why won't this print?
Hi all,
I presume the answer to this question is rather easy for most of you, but I've been trying all sorts of things, and it just won't print:
Code:<td valign="top"> <?php include('picsengine/component/photogallery/home.descp.php'); ?> <br><br> <?php if (isset($_GET['action'])) { ?> <?php include('picsengine/component/photogallery/home.gallery.php'); ?> <?php } ?> <?php if (isset($_GET['action']) == '') { ?> <a href="brands.php?category_id=<?php print($_GET['$category_id']); ?>&parent_id=0&lang=<?php print($_GET['$lang']); ?>&action=go"><img src="gui/brand_<?php print($_GET['$category_id']); ?>.jpg" border="0"></a> <?php } ?> </td>
Url's look like this: brands.php?category_id=1&parent_id=0&lang=nl .
Thanks in advance for your ideas.ThaVincy | redesigning your image
Twizted Imagebuilding personal and corporate reputation solutions
-
Mar 2, 2006, 10:06 #2
I don't think you need the ( and ). I usually use echo, not print, I think it's more of a personal preference though.
]
-
Mar 2, 2006, 10:11 #3
ga it annoys me when people start and end php tags like that. try this code:
PHP Code:<?PHP
echo '<td valign="top">';
include('picsengine/component/photogallery/home.descp.php');
echo '<br><br>';
if (isset($_GET['action'])) {
include('picsengine/component/photogallery/home.gallery.php');
}
if (isset($_GET['action']) == '') {
echo '<a href="brands.php?category_id=';
echo $_GET['$category_id'];
echo '&parent_id=0&lang=';
echo $_GET['$lang'];
echo '&action=go"><img src="gui/brand_';
echo $_GET['$category_id'];
echo '.jpg" border="0"></a>';
}
echo '</td>';
?>
-
Mar 2, 2006, 10:18 #4
- Join Date
- Oct 2005
- Location
- South Wales, UK
- Posts
- 1,134
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Or better still:
PHP Code:<?PHP
echo "<td valign='top'>";
include('picsengine/component/photogallery/home.descp.php');
echo "<br><br>";
if (isset($_GET['action'])) {
include('picsengine/component/photogallery/home.gallery.php');
}
if( empty($_GET['action']) ) { <<<OUT
<a href="brands.php?category_id=
$_GET['$category_id']
'&parent_id=0&lang='
$_GET['$lang']
'&action=go"><img src="gui/brand_'
$_GET['$category_id']
'.jpg" border="0"></a>'
}
OUT;
echo "</td>";
?>OMFG SitePoint ROXORZ TEH BIG ONE111!
Wish you were invisible?
-
Mar 3, 2006, 09:08 #5
- Join Date
- Mar 2003
- Location
- Flanders
- Posts
- 523
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Ok,
So I tried both examples of code.
The second ons keeps giving parse_errors af all kinds.
The first one displays the page as it should, but the function doesn't work, the link still reads like this in the source:
HTML Code:<a href="brands.php?category_id=&parent_id=0&lang=&action=go"> <img src="gui/brand_.jpg" border="0"> </a>
Any suggestions? Thanks in advance.ThaVincy | redesigning your image
Twizted Imagebuilding personal and corporate reputation solutions
-
Mar 3, 2006, 09:24 #6
First try this:
PHP Code:if (isset($_GET['action']) == '') {
echo '<a href="brands.php?category_id=';
echo $_GET['$category_id'];
echo '&parent_id=0&lang=';
echo $_GET['$lang'];
echo '&action=go"><img src="gui/brand_';
echo $_GET['$category_id'];
echo '.jpg" border="0"></a>';
} else {
echo "This crappy thing isn't working!!!!!!";
}
]
-
Mar 4, 2006, 06:51 #7
- Join Date
- Mar 2003
- Location
- Flanders
- Posts
- 523
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I don't understand really...
I can't manually replace these variables, because the browser has to read them from the url somehow. The visitor clicks a link, browser navigates, code reads the category_id and the action and displays content accordingly, no?ThaVincy | redesigning your image
Twizted Imagebuilding personal and corporate reputation solutions
-
Mar 4, 2006, 09:53 #8
- Join Date
- Dec 2003
- Location
- Albany, New York
- Posts
- 1,355
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Get the dollar signs out of your $_GET keys.
$_GET['category_id'] as opposed to $_GET['$category_id'], etc.
-
Mar 5, 2006, 05:43 #9
- Join Date
- Mar 2003
- Location
- Flanders
- Posts
- 523
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Offcourse! Stupid me!
*taps flat hand to forehead*
Works perfectly! Thanks a billion guys!ThaVincy | redesigning your image
Twizted Imagebuilding personal and corporate reputation solutions
Bookmarks