#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2012
    Posts
    17
    Rep Power
    0

    Problems with a link can some one pleaaasssse help me


    can some one help i wish to put a link that when clicked it should call asmall script that is it
    <?php
    $number = "5";
    $category = "2";
    include("path/to/show_news.php");
    ?>
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2005
    Location
    Vancouver, WA, USA
    Posts
    399
    Rep Power
    190
    I have no idea what you are asking.

    Your subject is "Problems with a link" and there is no link shown.

    Or is that the problem?
    Last edited by ttremain; November 24th, 2012 at 07:46 AM.
    Thomas Tremain
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2012
    Posts
    17
    Rep Power
    0
    i w wish to write a link that when click it is going to call that include function but i do not know how to go about it
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2003
    Posts
    3,601
    Rep Power
    595
    This is an html question not a PHP question.

    <a href="path/to/show_news.php">Show News</a>

    Comments on this post

    • NotionCommotion agrees
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2005
    Location
    Vancouver, WA, USA
    Posts
    399
    Rep Power
    190
    I'm not even sure why I'm continuing to add to this, the OP hasn't made any effort to show what he's tried already...

    Maybe something more like this: (Super simplified)

    Code:
    if ($_GET['include']==1) {
       include("path/to/show_news.php");
    }
    echo "<a href='{$_SERVER['REQUEST_URI']}?include=1'>Show News</a>";
    Thomas Tremain
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Location
    Norfolk, UK
    Posts
    3
    Rep Power
    0
    Otherwise the script can be loaded on page load but hidden, to later be displayed onclick with the link.

    For example, in the header place the following...

    Code:
    <style type="text/css">
    	#hidden_area { display: none; }
    </style>
    
    <script type="text/javascript">
    	function showhide( element_id ){
    		document.getElementById( element_id ).style.display = 'block';
    		return false;
    	}
    </script>
    And then in the content of the document, you can place the link and the block of content anywhere you like:

    Code:
    <a href="#" onclick="return showhide( 'hidden_area' );">Show or Hide div</a>
    
    <div id="hidden_area">
    	<?php 
    		$number = "5"; $category = "2";
    		include("path/to/show_news.php");
    	?>
    </div>
    This allows you to avoid reloading the page on the click of the button to allow you to present a seamless experience for the user.

    [W34VER]

IMN logo majestic logo threadwatch logo seochat tools logo