Results 1 to 11 of 11

Thread: Can I use PHP rather than an Iframe?

  1. #1
    Join Date
    Sep 2006

    Can I use PHP rather than an Iframe?

    I was wondering if I could use PHP to embed my CGI Email form in my index page. My host requires that I put my CGI script in a special folder (CGI wrapper) so including it on the index page is not possible unless I embed it somehow. I really donít want to use an iframe. Can I accomplish this with PHP? Could someone provide an example?

  2. #2
    Join Date
    Dec 2006
    Yes. Just use a PHP include. Let's say I wanted to include form.html on index.php...

    <?php include("form.html"); ?>
    Simple as that.

  3. #3
    Join Date
    Sep 2006
    So it's size is defined by the element it's embedded in? Let's say:

    <div style="width:300px; height:300px;">
    <?php include("form.html"); ?>

    And there's no extra coding for the page to be embedded(In this example the page called "form.html")?

    I ended up using an ajax and it works fine but if my host will allow me to do this instead I think it'd be a better way to go (no JS). Thanks for your help PHPSHIFT2.

  4. #4
    Join Date
    Sep 2006
    I contacted my host and they said it's supported, but I'm still unable to get it to work. I read this somewhere: "The way PHP handles the ./ and ../ is totally counter intuitive." But they didn't really elaborate.

    If my parent html file (index.html) is in the root and I want to access a file that's in a folder in the root, normally I'd write the path like this: "folder/form.html". Is the path different in PHP?
    Last edited by bustya; 12-27-2006 at 08:50 AM.

  5. #5
    Join Date
    Jun 2006
    I would use
    PHP Code:
    <?PHP include('./folder/form.html');?>

  6. #6
    Join Date
    Dec 2006
    Well, "./" stays in the same directory while "../" goes up one directory. It's pretty simple. Let's say you were in "yoursite.com/dir/subdir" and you wanted to include the file "yoursite.com/dir/difdir/form.html". You'd just do this:
    PHP Code:
    <div style="width: 300; height: 300; overflow: auto; ">
    <?php include("../difir/form.html"); ?>

  7. #7
    Join Date
    Sep 2006
    Thanks again PHPSHIFT2, but it appears my troubles are with my host and not my code. I tried this a million different ways (PHP, ASP, ISS) and it still isn't working. I notified my host and they're dumbfounded. I think the trouble is that PHP support hasn't been activated on my account, but I've looked all through my CPanel and can't find where I need to activate it. So I'm hoping the support folks can steer me in the right direction. To try to weed out the problem I uploaded two test files to the same directory and used the path "./red.html" and it's not working.

    Question: ./ = this directory and ../ = up one directory so ./folder/file.html will look in the current directory for a folder and then inside that one for the file, right?

    That's the path I'll need to take if support can figure out why my account is malfunctioning.
    Last edited by bustya; 01-15-2007 at 12:59 PM.

  8. #8
    Join Date
    Jun 2006
    try renaming it to testphp.php not html

  9. #9
    Join Date
    Dec 2006
    Quote Originally Posted by aussie girl
    try renaming it to testphp.php not html
    Precisely. Name it testphp.php. Simple solution.

  10. #10
    Join Date
    Dec 2006
    Escazķ (Costa Rica) and Mallorca (Spain)
    From your original question, my understanding is that the page that you are trying to include is a CGI script, then including it via "include()" will not really work because the only processing that will be applied to it will be PHP and not whatever CGI Handler has been defined on the web server. The reason is that PHP does a local file system read on the file and then applies PHP rules to whatever it finds in there. If it's non-PHP, it will just output as-is whatever it finds.

    You may not like it, but ultimately, you may have to resort to a <frame> or <iframe> to get the CGI script to run as it should and display the results in a semi-controlled fashion.

    There could be another way, which would be to use the so-called "Apache-specific Functions" (see: http://www.php.net/manual/en/ref.apache.php), but I've never done it so I'm not going down that road. But perhaps someone else has experience with it...

  11. #11
    Join Date
    Sep 2006
    Quote Originally Posted by aussie girl
    try renaming it to testphp.php not html

    Yep that was the issue, this was my first experience with PHP and I didn't realize. Thanks everyone.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



X vBulletin 4.2.2 Debug Information

  • Page Generation 0.39281 seconds
  • Memory Usage 2,944KB
  • Queries Executed 13 (?)
More Information
Template Usage (35):
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (1)bbcode_code
  • (2)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (11)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (11)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (70):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates