jeeremie Posted July 23, 2007 Share Posted July 23, 2007 Hello, I am using a simple online commerce system and I need to have an introduction (image+text) that will only appear on the home page (see demo). I already created a file called intro.php. Any ideas? Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/61406-solved-i-want-an-introduction-to-appear-only-on-the-homepage/ Share on other sites More sharing options...
soycharliente Posted July 23, 2007 Share Posted July 23, 2007 How are you going to include the image? With CSS: You could isset($_GET["c"]) and include different CSS files with header image declarations. Without: Same concept but with < img > tags. Link to comment https://forums.phpfreaks.com/topic/61406-solved-i-want-an-introduction-to-appear-only-on-the-homepage/#findComment-305593 Share on other sites More sharing options...
jeeremie Posted July 23, 2007 Author Share Posted July 23, 2007 This is my intro.php file: <?php if (!defined('WEB_ROOT')) { exit; } ?> <h1>Handmade Dolls <span>for Key-Ring by Ann</span></h1> <div class="text"> <img class="center" src="images/intro.jpg" /> <big class="center">Welcome to Hailstorm Design!</big> </div> <!--Intro--> Link to comment https://forums.phpfreaks.com/topic/61406-solved-i-want-an-introduction-to-appear-only-on-the-homepage/#findComment-305596 Share on other sites More sharing options...
soycharliente Posted July 23, 2007 Share Posted July 23, 2007 I would do it using CSS. Give the header box, your div that contains the image, an id and in your CSS file define all it's attributes. On every other page, use a different id with different attributes. Example: index.php <div id="home" class="text"> <big class="center">Welcome to Hailstorm Design!</big> </div> allothers.php <div id="nothome" class="text"> <big class="center">Welcome to Hailstorm Design!</big> </div> screen.css #home { width: 150px; height: 150px; background: url("../img/homebg.jpg"); } #nothome { width: 150px; height: 150px; background: url("../img/nothomebg.jpg"); } Link to comment https://forums.phpfreaks.com/topic/61406-solved-i-want-an-introduction-to-appear-only-on-the-homepage/#findComment-305625 Share on other sites More sharing options...
cooldude832 Posted July 23, 2007 Share Posted July 23, 2007 try <?php if($_SERVER['self'] == "Page you want it to be on"){ echo "The Intro"; } ?> Link to comment https://forums.phpfreaks.com/topic/61406-solved-i-want-an-introduction-to-appear-only-on-the-homepage/#findComment-305636 Share on other sites More sharing options...
tippy_102 Posted July 23, 2007 Share Posted July 23, 2007 $realname = basename($_SERVER[sCRIPT_FILENAME], ".php"); if ($realname == 'index') { echo "This is the place for the intro text that only appears on the index page"; include_once "intro.php"; } Link to comment https://forums.phpfreaks.com/topic/61406-solved-i-want-an-introduction-to-appear-only-on-the-homepage/#findComment-305692 Share on other sites More sharing options...
jeeremie Posted July 24, 2007 Author Share Posted July 24, 2007 Thanks guy for your support. Unfortunately it isn't working as i want. The thing is I have the categories on the homepage as well. When I select a categorie, it loads the products on the same page (index.php). But I don't want to have the Intro and the products on the same page. I would be too busy. Here is the index.php: <?php require_once 'library/config.php'; require_once 'library/category-functions.php'; require_once 'library/product-functions.php'; require_once 'library/cart-functions.php'; $_SESSION['shop_return_url'] = $_SERVER['REQUEST_URI']; $catId = (isset($_GET['c']) && $_GET['c'] != '1') ? $_GET['c'] : 0; $pdId = (isset($_GET['p']) && $_GET['p'] != '') ? $_GET['p'] : 0; require_once 'include/header.php'; ?> <?php require_once 'include/top.php'; ?> <?php require_once 'include/leftNav.php'; ?> <div id="content"> <div class="text"> <!--******--> <!--I need to add the intro here!--> <h1>Handmade Dolls <span>for Key-Ring by Ann</span></h1> <div class="text"> <img class="center" src="images/intro.jpg" /> <big class="center">Welcome to Hailstorm Design!</big> </div> <!--Intro--> <!--******--> <!-- ... and now the script generating the categories and products related--> <?php if ($pdId) { require_once 'include/productDetail.php'; } else if ($catId) { require_once 'include/productList.php'; } else { require_once 'include/categoryList.php'; } ?> </div> </div> <!--/Content--> <?php require_once 'include/rightNav.php'; ?> <?php require_once 'include/footer.php'; ?> I hope this helps. Link to comment https://forums.phpfreaks.com/topic/61406-solved-i-want-an-introduction-to-appear-only-on-the-homepage/#findComment-306398 Share on other sites More sharing options...
redarrow Posted July 24, 2007 Share Posted July 24, 2007 can you kindly tell me why you want a intro as a intro only cause seo problams? Link to comment https://forums.phpfreaks.com/topic/61406-solved-i-want-an-introduction-to-appear-only-on-the-homepage/#findComment-306402 Share on other sites More sharing options...
jeeremie Posted July 24, 2007 Author Share Posted July 24, 2007 Hmmm, I realize this but my customer wants it. What can I do? Customer is king as we say in France. Link to comment https://forums.phpfreaks.com/topic/61406-solved-i-want-an-introduction-to-appear-only-on-the-homepage/#findComment-306405 Share on other sites More sharing options...
redarrow Posted July 24, 2007 Share Posted July 24, 2007 the only reel way i can see this working is using a intro as the index page then and within the intro add a skip link that points to main website page. example. the user goes to the website the user sees the intro for 10 secounds and redirect to main website if user press the skip intro button go main website. Link to comment https://forums.phpfreaks.com/topic/61406-solved-i-want-an-introduction-to-appear-only-on-the-homepage/#findComment-306411 Share on other sites More sharing options...
jeeremie Posted July 24, 2007 Author Share Posted July 24, 2007 ok, I thought about this but my customer really wants the categories on the same page. So I will change the question. I include the intro with this script (someone from another forum gave me this): <?php if (basename($_SERVER['PHP_SELF']) == 'index.php') { include 'include/categoryList.php'; } ?> How could I change the next script... <!--<?php if ($pdId) { require_once 'include/productDetail.php'; } else if ($catId) { require_once 'include/productList.php'; } else { require_once 'include/categoryList.php'; } ?> --> ...to have only the category list on the main page and "product list" and "product detail" on another page. For example, Could I create a page product.php page (with productList.php and productDetail.php on it) and when I select a category on index.php I would be redirected to this page? Do you think it could be possible? Link to comment https://forums.phpfreaks.com/topic/61406-solved-i-want-an-introduction-to-appear-only-on-the-homepage/#findComment-306439 Share on other sites More sharing options...
jeeremie Posted July 24, 2007 Author Share Posted July 24, 2007 Ok, finally I gave up. I realized I was asking each of you too much and changed my e-commerce sytem to be opencart. it does everything I want and even more. Thanks a lot. Link to comment https://forums.phpfreaks.com/topic/61406-solved-i-want-an-introduction-to-appear-only-on-the-homepage/#findComment-306493 Share on other sites More sharing options...
cooldude832 Posted July 24, 2007 Share Posted July 24, 2007 This is just an idea, but what if you use a cookie/ajax system where once the video plays an ajax will set a session/cookie saying intro seen. Its seemless and will work if you don't change urls Link to comment https://forums.phpfreaks.com/topic/61406-solved-i-want-an-introduction-to-appear-only-on-the-homepage/#findComment-306500 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.