Page 2 of 2 FirstFirst 12
Results 11 to 18 of 18

Thread: Include file as a variable

  1. #11
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    What are the contents of the file that you are trying to include? Also, what version of PHP do you have as functions vary for each branch.

    Edit: To see a working example of my code, go to http://thetestingsite.net/test.php. You can check out the contents of test.html and see what is in that file and that it is being included. To see the php, go to test.phps.


    Hope this helps.
    Last edited by thetestingsite; 03-21-2008 at 11:23 PM.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  2. The Following User Says Thank You to thetestingsite For This Useful Post:

    kuau (03-23-2008)

  3. #12
    Join Date
    Sep 2007
    Location
    Maui
    Posts
    642
    Thanks
    284
    Thanked 15 Times in 15 Posts

    Default

    Here are the contents of the right-hm.html file. It is just a list of items for the righthand column of the page, but it appears on 5 pages so I use an include:

    Code:
    &nbsp;&nbsp;<a class="agency" href="/html/rates.html#Alamo"><img src="/img/gr/logo_alamo.gif" alt="Click for Alamo Rates" width="31" height="19" /></a>
    <a class="agency" href="/html/rates.html#Avis"><img src="/img/gr/logo_avis.gif" alt="Click for Avis rates" width="38" height="19" /></a>
    <a class="agency" href="/html/rates.html#Budget"><img src="/img/gr/logo_budget.gif" alt="Click for Budget rates" width="34" height="19" /></a>
    <a class="agency" href="/html/rates.html#Dollar"><img src="/img/gr/logo_dollar.gif" alt="Click for Dollar rates" width="42" height="19" /></a>
    <a class="agency" href="/html/rates.html#Thrifty"><img src="/img/gr/logo_thrifty.gif" alt="Click for Thrifty rates" width="39" height="19" /></a>
    <ul>
      <li><a href="/html/faq.html#bargain"><b>Bargain rates</b></a> for late model cars through major rental car companies.</li>
      <li><a href="/html/faq.html#guaranteed"><b>Guaranteed</b></a> reservation, no credit card&nbsp;required.</li>
      <li><a href="/html/faq.html#reserve"><b>Reservations</b></a> are subject to availability of the chosen car type at the pick-up location.</li>
      <li><a href="/html/faq.html#airport"><b>Airport</b></a> pick up for all cars.</li>			
      <li><a href="/html/faq.html#Driver"><b>Additional</b></a> driver is free!!</li>
      <li>For 12-Pax Van &amp; <a href="/html/faq.html#suv"><b>Fullsize SUV</b></a> rates please inquire by 
      <a href="mailto:info@carrentalhawaii.com?subject=12PaxVan/FullsizeSUV%20Rental%20Inquiry">email</a>.</li>
      <li>For Molokai rates please inquire by <a href="mailto:info@carrentalhawaii.com?subject=Molokai Rental Inquiry"><b>email</b></a>.</li>
      <li>Special deal for <a href="/html/canadian.html"><b>Canadian customers</b></a>. <img src="/img/gr/cdn-flag-sm.jpg" alt="Canadian Flag" width="30" height="18"></li>
      <li><b>Cruise Ship Passengers:</b> <a href="/html/cruise-ship.html"><b>click here</b></a> for special instructions.</li>
    </ul>
    To be honest, I can't afford to spend any more time on this issue as I have other work and I have it working by using the database. So I thank you very much for your efforts and am letting you abandon the quest.

    But you can perhaps help me with this please. What is the php code to add a BCC so that it will blind copy the email to another address without displaying the email address?

    Code:
    $subject = "Generic Website Inquiry";
    $mailto  = "Ken <kenw@gmail.com>";
    mail($mailto,$subject,$body,"From:$sender");
    Thanks, erin

  4. #13
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Quote Originally Posted by kuau View Post
    Here are the contents of the right-hm.html file. It is just a list of items for the righthand column of the page, but it appears on 5 pages so I use an include:

    Code:
    &nbsp;&nbsp;<a class="agency" href="/html/rates.html#Alamo"><img src="/img/gr/logo_alamo.gif" alt="Click for Alamo Rates" width="31" height="19" /></a>
    <a class="agency" href="/html/rates.html#Avis"><img src="/img/gr/logo_avis.gif" alt="Click for Avis rates" width="38" height="19" /></a>
    <a class="agency" href="/html/rates.html#Budget"><img src="/img/gr/logo_budget.gif" alt="Click for Budget rates" width="34" height="19" /></a>
    <a class="agency" href="/html/rates.html#Dollar"><img src="/img/gr/logo_dollar.gif" alt="Click for Dollar rates" width="42" height="19" /></a>
    <a class="agency" href="/html/rates.html#Thrifty"><img src="/img/gr/logo_thrifty.gif" alt="Click for Thrifty rates" width="39" height="19" /></a>
    <ul>
      <li><a href="/html/faq.html#bargain"><b>Bargain rates</b></a> for late model cars through major rental car companies.</li>
      <li><a href="/html/faq.html#guaranteed"><b>Guaranteed</b></a> reservation, no credit card&nbsp;required.</li>
      <li><a href="/html/faq.html#reserve"><b>Reservations</b></a> are subject to availability of the chosen car type at the pick-up location.</li>
      <li><a href="/html/faq.html#airport"><b>Airport</b></a> pick up for all cars.</li>			
      <li><a href="/html/faq.html#Driver"><b>Additional</b></a> driver is free!!</li>
      <li>For 12-Pax Van &amp; <a href="/html/faq.html#suv"><b>Fullsize SUV</b></a> rates please inquire by 
      <a href="mailto:info@carrentalhawaii.com?subject=12PaxVan/FullsizeSUV%20Rental%20Inquiry">email</a>.</li>
      <li>For Molokai rates please inquire by <a href="mailto:info@carrentalhawaii.com?subject=Molokai Rental Inquiry"><b>email</b></a>.</li>
      <li>Special deal for <a href="/html/canadian.html"><b>Canadian customers</b></a>. <img src="/img/gr/cdn-flag-sm.jpg" alt="Canadian Flag" width="30" height="18"></li>
      <li><b>Cruise Ship Passengers:</b> <a href="/html/cruise-ship.html"><b>click here</b></a> for special instructions.</li>
    </ul>
    To be honest, I can't afford to spend any more time on this issue as I have other work and I have it working by using the database. So I thank you very much for your efforts and am letting you abandon the quest.
    Well, as you can see from the example link I posted above, it should work just fine no matter what your HTML code is.

    But you can perhaps help me with this please. What is the php code to add a BCC so that it will blind copy the email to another address without displaying the email address?

    Code:
    $subject = "Generic Website Inquiry";
    $mailto  = "Ken <kenw@gmail.com>";
    mail($mailto,$subject,$body,"From:$sender");
    Thanks, erin
    View this code snippet taken from php.net's documentation that shows how to send an HTML email to multiple recipients (the headers also include a BCC address so this should be helpful for you.

    Code:
    <?php
    // multiple recipients
    $to  = 'aidan@example.com' . ', '; // note the comma
    $to .= 'wez@example.com';
    
    // subject
    $subject = 'Birthday Reminders for August';
    
    // message
    $message = '
    <html>
    <head>
      <title>Birthday Reminders for August</title>
    </head>
    <body>
      <p>Here are the birthdays upcoming in August!</p>
      <table>
        <tr>
          <th>Person</th><th>Day</th><th>Month</th><th>Year</th>
        </tr>
        <tr>
          <td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
        </tr>
        <tr>
          <td>Sally</td><td>17th</td><td>August</td><td>1973</td>
        </tr>
      </table>
    </body>
    </html>
    ';
    
    // To send HTML mail, the Content-type header must be set
    $headers  = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    
    // Additional headers
    $headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "\r\n";
    $headers .= 'From: Birthday Reminder <birthday@example.com>' . "\r\n";
    $headers .= 'Cc: birthdayarchive@example.com' . "\r\n";
    $headers .= 'Bcc: birthdaycheck@example.com' . "\r\n";
    
    // Mail it
    mail($to, $subject, $message, $headers);
    ?>
    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  5. The Following User Says Thank You to thetestingsite For This Useful Post:

    kuau (03-23-2008)

  6. #14
    Join Date
    Sep 2007
    Location
    Maui
    Posts
    642
    Thanks
    284
    Thanked 15 Times in 15 Posts

    Default

    I am using php4, because if I set it to php5, the email script does not retain the value of the variables and sends blanks - no idea why.

    I just tried doing exactly what you did with:
    Code:
    $rightcol  = file_get_contents('right-hm.html');
    with this in the template file:
    Code:
    <div id="right-hm">
          <?php echo $rightcol; ?>
    </div>
    and the column disappeared again - it makes no sense.

    What php version are you using? Now I'll try the BCC part. This is very discouraging. Thanks for your help and persistence. Aloha, erin

  7. #15
    Join Date
    Sep 2007
    Location
    Maui
    Posts
    642
    Thanks
    284
    Thanked 15 Times in 15 Posts

    Default

    Forgot to mention that I was not using html mail. Do you have to use html to use BCC?

  8. #16
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Quote Originally Posted by kuau View Post
    Forgot to mention that I was not using html mail. Do you have to use html to use BCC?
    No you do not. I just pulled that off of the php.net documentation. You can just strip out what you don't need and should be good to go. As for the version of php I am using, it is php 5.2.5 as php 4 is about to be non-supported. Anyways, file_get_contents works with versions greater than or equal to PHP 4.3.0 so that should still work for you unless there are other issues with your code.

    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  9. The Following User Says Thank You to thetestingsite For This Useful Post:

    kuau (03-24-2008)

  10. #17
    Join Date
    Sep 2007
    Location
    Maui
    Posts
    642
    Thanks
    284
    Thanked 15 Times in 15 Posts

    Default

    The version of php is 4.4.7. so I have no idea why that right colum thing doesn't work using your get_file_contents. The server has php5 available as well, which I would like to use, but my email script stops working. Would you mind please looking at the email script (it is only one screen long) and telling me why php5 won't run it? The only things I know about php are from inheriting some old scripts from some guy who had poor programming practices. I swear it's a miracle anything I write works. Your BCC suggestion did work (thanks!) but I don't see why it needs so many quote marks. You'll see in the script the old way and the new way I just added. I'd like to combine them to kind of "zen" the code. I don't want to impose upon your good will, so it's OK if you say no. Thanks, erin

  11. #18
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Show me the code and I'll take a look to see what I can do. Also, what actually happens with your script when you switch from php 4 to 5? It could be just a simple issue within your ini file (such as register_globals on in one and not the other, or missing extensions, or something else altogether). In any case, show the code (or PM/IM/email me the code) and I'll see what I can do.

    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  12. The Following User Says Thank You to thetestingsite For This Useful Post:

    kuau (03-24-2008)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •