Jump to content

healthbasics

Members
  • Posts

    58
  • Joined

  • Last visited

Posts posted by healthbasics

  1. Not quite but following your logic I got it. 

     

    what i needed was

     

    <?php echo "/img/" . $pic[rand(0,1)]; ?>
    

     

    <?php echo "/img/" . $pic[rand(0,2)]; ?> 
    

     

    gave me each picture sometimes and once in a while a blank.  I figure 0,2 must be an array of 3 with values of 0, 1, 2...

     

    Thanks!

     

  2. halfway there.  This time it appears to work half the time.

     

    Half the time it returns:

     

    <div id="main-image"><img src="/img/" height="240px" width="240px" alt="" /></div>

     

    and the other half

     

    <div id="main-image"><img src="/img/shot2.jpg" height="240px" width="240px" alt="" /></div>

     

     

    It seems like whenever it selects shot1.jpg from the random function it returns nothing....  :confused:

  3. I guess I screwed something up. 

     

    Can I call it like this or no?

     

    Do i have to cram that whole statement together as one into the spot where I want the image or did I just put a quote in the wrong place or something?

     

    <?php 
    
    $pic = array(
    "shot1.jpg",
    "shot2.jpg",
    );
    
    ?>
    
    
    </div>
    	<div id="right-column">
    		<div id="main-image"><img src="<?php echo "/img/'.$pic[rand(1,2)].'" ?>" height="240px" width="240px" alt="" /></div>
    		<div class="sidebar">
    			<ul id="menu">
    

     

    My pics are stored in a subdir called img/ from the root.

     

    mydomain.com/img/ for example.

     

    Thanks.

  4. My index.php is:

     

    
    <?php 
    
    include "menu.inc.php";
    
    function menu($_menu){
    $str = '';
    foreach($_menu as $url => $name){
    	$sel = ($_GET['page'] == $url ) ? ' id="selected" ' : '';
    	$str .= "<li ". $sel ."><a class='five' href=" . $url . " >" . $name . "</a></li>";
    }
    echo $str;
    }
    
    $page = ( isset($_GET['pg']) ?  $_GET['pg'] : ((isset($_GET['page']))? $_GET['page']:'home'));
    
    $file = basename($page).'.php';
    $html_path = "php/";
    
    if (file_exists($html_path.$file)) include $html_path.$file;
    ?>
    

     

    ANd my first guess was wildly wrong - doing that creates a nice blank white page for *everything*!

  5. ?page=[good name] loads .\php\[good name].php

     

    I am not real picky about the exact mechanics of how to do this or what is displayed so long as it's SOMETHING.  I just felt like it should be something more than a totally blank white page incase somebody links in with a malformed link. 

     

    Automatic redirection to the root home page would be fine.  Redirection to my 404 page would be fine too, really anything besides just a plain blank page.

     

    If this is a huge deal or requires my sql implementation to do it I'll definitely put this on the back burner but I thought there might be a quick fix. 

  6. I assume, that on your application you check if $_GET['page'] variable is something meaningful (e.g. there's some content related to it in database), or it's just garbage. If it's garbage, use header() to redirect.

     

    Example with MySQL:

    <?php
    $page = mysql_real_escape_string($_GET['page']);  //make sure nothing harmful get's injected into query
    $sql = "SELECT ... FROM pages WHERE page = '$page'";
    $result = mysql_query($sql);
    if(mysql_num_rows($result) == 0) { //check if any rows got returned
      //redirect to 404
    } else {
      //display data
    }

     

    I don't have my sql and there is no implementation for checking or anything in place.  That's what I'm trying to do now.  I was trying to prevent people that send a bad request (for example if the site changes and there are latent search engine links) from simply getting a completely blank white page.

     

    Is there an easy way to do this?

     

    @DevilsAdvocate - I read that but it doesn't really make clear to me what I have to put where to accomplish what I'm trying to do.

  7. The mouseover highlight already works just fine (and always did).  The highlight for the current page used to work until I made some changes given here today to allow easier linking to external sites on the menu.  I am trying to get it back to the point where the button for the page you are currently viewing would be highlighted.  ANy idea how to do that?

     

    I tried swaping the line of code you recommended but it resulted in the page not loading at all.  It would just be completley blank when I visited the home page.

  8. what styles are you using?

     

    Below is my style.css - would that answer your question?

     

    body {

    font : normal 12px/1.6em Arial, Helvetica, sans-serif;

    color : #2a3845;

    margin : 0;

    padding : 0;

    background-color: #7b7b7b;

    background-image: url(../img/bg_main.jpg);

    background-repeat: repeat-x;

    background-position: top;

    }

    p { margin : 0;padding : 0;}

    a:visited, a:link {color : #a43b55;text-decoration : underline;background:none;}

    a:hover {color : #a43b55;text-decoration : none;background:none; cursor:pointer;}

    h1 {

    color : #7a2e40;

    margin: 0px 0px 10px 0px;

    padding-bottom : 10px;

    border-bottom : 1px solid #efece7;

    font-family: quicksand;

    font-size: 17px;

    font-style: normal;

    font-weight: normal;

    font-variant: normal;

    }

    h2 {

    color : #7a2e40;

    margin : 20px 0 10px;

    padding-bottom : 10px;

    border-bottom : 1px solid #efece7;

    font-family: quicksand;

    font-size: 17px;

    font-style: normal;

    font-weight: normal;

    font-variant: normal;

    }

    h3 {

    color : #7a2e40;

    padding-bottom : 10px;

    border-bottom : 1px solid #efece7;

    margin-top: 20px;

    margin-right: 0;

    margin-bottom: 10px;

    margin-left: 0;

    font-family: quicksand;

    font-size: 14px;

    font-weight: bold;

    }

     

    h4 {

    color : #7a2e40;

    padding-bottom : 10px;

    margin-top: 20px;

    margin-right: 0;

    margin-bottom: 10px;

    margin-left: 0;

    font-family: quicksand;

    font-size: 14px;

    font-weight: bold;

    }

     

    #year a {

    border:none;

    text-decoration:none;

    font-size:14px;

    border-bottom-width: 1px;

    border-bottom-style: solid;

    border-bottom-color: #a43b55;

    }

     

    #year a:hover {

    color: #777;

    border-bottom-width: 1px;

    border-bottom-style: solid;

    border-bottom-color: #a43b55;

    }

     

    ul {padding:0;margin:0 0 0 17px;list-style: square url(../img/bullet.gif);}

    .box {

    border : 1px solid #f0e9eb;

    padding : 15px;

    -moz-border-radius: 5px;

    -webkit-border-radius: 5px;

    background-color: #fff;

    background-image: url(../img/bg_box.jpg);

    background-repeat: repeat-x;

    background-position: top;

    -box-shadow: 0px 0px 5px #dbdbdb;

    -webkit-box-shadow: 0px 0px 5px #dbdbdb;

    -moz-box-shadow: 0px 0px 5px #dbdbdb;

    -moz-border-radius: 5px;

    -webkit-border-radius: 5px;

     

    }

     

    .box2 {

    border : 1px solid #f0e9eb;

    width: 370px;

    margin-left: 150px;

    margin-top: -20px;

    margin-bottom: 25px;

    padding-top: 10px;

    padding-right: 10px;

    padding-bottom: 10px;

    padding-left: 10px;

    -moz-border-radius: 5px;

    -webkit-border-radius: 5px;

    background-color: #fff;

    background-image: url(../img/bg_box.jpg);

    background-repeat: repeat-x;

    background-position: top;

    -box-shadow: 0px 0px 5px #dbdbdb;

    -webkit-box-shadow: 0px 0px 5px #dbdbdb;

    -moz-box-shadow: 0px 0px 5px #dbdbdb;

    }

     

     

    #wrapper {

    width : 950px;

    border-left : 1px solid #f0e9eb;

    border-right : 1px solid #f0e9eb;

    margin-top: 0;

    margin-right: auto;

    margin-bottom: 0;

    margin-left: auto;

    background-color: #FFFFFF;

    -box-shadow: 0px 0px 20px #545454;

    -webkit-box-shadow: 0px 0px 20px #545454;

    -moz-box-shadow: 0px 0px 20px #545454;

    -moz-border-radius-bottomleft: 15px; -webkit-border-bottom-left-radius: 15px;

    -moz-border-radius-bottomright: 15px; -webkit-border-bottom-right-radius: 15px;

    }

    #header {

    margin-top: 0;

    margin-right: 0px;

    margin-bottom: 0;

    margin-left: 0px;

    }

    #bg {height : 36px;background : url(img/bg.gif) repeat-x;}

    #nav {

    padding : 10px 20px;

    text-align : right;

    color : #fdfdfd;

    background-image: url(../img/bg_header2.jpg);

    background-repeat: repeat-x;

    background-position: top;

    -moz-border-radius-bottomleft: 7px;

    -webkit-border-bottom-left-radius: 7px;

    -moz-border-radius-bottomright: 7px;

    -webkit-border-bottom-right-radius: 7px;

    }

    #nav a:visited, #nav a:link {

    text-decoration : none;

    color : #ededed;

    }

    #nav a:hover {text-decoration : underline;color : #fdfdfd;}

    #main-content {margin : 0 auto;}

    #logo {

    margin-bottom : 45px;

    margin-top: 5px;

    margin-left: -15px;

    }

    .logotxt1 {

    color : #fa7393;

    margin : 10px 0 0 15px;

    font-family: quicksand;

    font-size: 20px;

    font-style: normal;

    font-weight: normal;

    font-variant: normal;

    }

    .logotxt2 {font : normal 20px quicksand, serif;color : #7a2e40; }

    .logotxt3 {

    color : #7a2e40;

    font-family: quicksand, serif;

    font-size: 9px;

    font-style: normal;

    font-weight: normal;

    font-variant: normal;

    vertical-align: super;

    }

    #left-column {

    width : 600px;

    float : left;

    padding-top: 0;

    padding-right: 5px;

    padding-bottom: 30px;

    padding-left: 30px;

    }

    #right-column {width : 300px;float : right;}

    .crd a:visited, .crd a:link, .crd a:hover{text-decoration : none;color : #2a3845;cursor: text;}

    #footer {

    border-top : 1px solid #f0e9eb;

    clear : both;

    padding-top: 20px;

    padding-right: 15px;

    padding-bottom: 20px;

    padding-left: 25px;

    height: 70px;

    background-image: url(../img/bg_footer.jpg);

    background-repeat: repeat-x;

    background-position: top;

    }

     

    #footer_copy {

    float:left;

    margin-top:24px;

    }

     

    #footer_links {

    float:right;

    margin-right:20px;

    }

     

    #footer_links img {

    border:none;

    }

     

     

    .sidebar img {

    border:none;

    }

     

     

    #main-image {

    text-align : center;

    margin-top: 15px;

    padding: 4px;

    -box-shadow: 0px 0px 5px #dbdbdb;

    -webkit-box-shadow: 0px 0px 5px #dbdbdb;

    -moz-box-shadow: 0px 0px 5px #dbdbdb;

    -moz-border-radius: 5px;

    -webkit-border-radius: 5px;

    height: 240px;

    width: 240px;

    margin-left: 30px;

    }

    .sidebar {width : 218px;margin : 0 auto;padding : 10px 25px;background : url(img/shadow.jpg) no-repeat top;}

     

    @font-face { font-family: quicksand; src: url('../css/quicksand.otf'); } @font-face { font-family: quicksand; font-weight: bold; src: url('../css/quicksand.otf'); }

     

    #menu{

    list-style: none;

    width: 220px;

    float: left;

    margin-top: 2em;

    margin-bottom: 2em;

    margin-left: 0px;

    }

    #menu li{

    padding: 0;

    margin: 0;

    list-style-image: none;

    list-style-type: none;

    }

    #menu a{

    display: block;

    color: #666666;

    background-color: #eeeeee;

    font-weight: lighter;

    text-decoration: none;

    width: 207px;

    padding-top: 0.4em;

    padding-right: 0.3em;

    padding-bottom: 0.4em;

    padding-left: 0.8em;

    margin-top: 2px;

    margin-right: 0px;

    margin-bottom: 2px;

    margin-left: 0px;

    list-style-image: none;

    list-style-type: none;

    -moz-border-radius: 4px;

    -webkit-border-radius: 4px;

    background-image: url(../img/bg_menu.jpg);

    background-repeat: repeat-x;

    }

     

    #menu a:hover{

    color: #fff;

    background-color: #333333;

    font-weight: lighter;

    -box-shadow: 0px 0px 7px #696969;

    -webkit-box-shadow: 0px 0px 7px #696969;

    -moz-box-shadow: 0px 0px 7px #696969;

    background-image: url(../img/bg_menu_hover.jpg);

    background-repeat: repeat-x;

    background-position: top;

    border:none;

    }

     

     

    #selected {

    font-weight: lighter;

    border:none;

    }

     

    #selected a {

    color: #fff;

    background-color: #585858;

    font-weight: lighter;

    -box-shadow: 0px 0px 7px #696969;

    -webkit-box-shadow: 0px 0px 7px #696969;

    -moz-box-shadow: 0px 0px 7px #696969;

    background-image: url(../img/bg_menu_selected.jpg);

    background-repeat: repeat-x;

    background-position: top;

    border:none;

     

    #easyTooltip{

    border:1px solid #a1a1a1;

    color:#fff;

    box-shadow: 0px 0px 6px #333333;

    -webkit-box-shadow: 0px 0px 6px #333333;

    -moz-box-shadow: 0px 0px 6px #333333;

    -moz-border-radius: 5px; -webkit-border-radius: 5px;

    padding-top: 7px;

    padding-right: 10px;

    padding-bottom: 9px;

    padding-left: 10px;

    background-color: #5e5e5e;

    background-image: url(../lib/easytooltip/bg.gif);

    background-repeat: repeat-x;

    }

     

     

    strong {

    font-size: 13px;

    color: #a43b55;

    }

  9. My website used to highlight the current link in a dark color (similar to the mouseover or maybe even the same) but when I made some updates to allow external links more easily and to correct a problem with global variables someone here recommended I change the highlighting stopped working.  Anyone know how I can turn it back on?

     

    Menu list code:

    
    <?
    $_menu = array('index.php?page=home' => 'Philosophy & Focus',
    'index.php?page=biography' => 'Biography',
    'index.php?page=consultations' => 'Consultations',
    'index.php?page=classes' => 'Classes',
    'index.php?page=client_comments' => 'Client Comments',
    'index.php?page=calendar' => 'Calendar',
    'http://shop.healthbasics.net/collections/health-basics' => 'Products',
    'http://www.healthbasics.net/blog/' => 'Blog',
    'index.php?page=recommended_reading' => 'Recommended Reading',
    'index.php?page=recommended_viewing' => 'Recommended Viewing',
    'index.php?page=links_resources' => 'Links & Resources',
    );
    

     

    And here is how it gets called from index.php:

    include "menu.inc.php";
    
    function menu($_menu){
    $str = '';
    foreach($_menu as $url => $name){
    	$sel = ($_GET['page'] == $url ) ? ' id="selected" ' : '';
    	$str .= "<li ". $sel ."><a href=" . $url . " >" . $name . "</a>\n";
    }
    echo $str;
    }
    

     

    Thanks. 

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.