Jump to content

Search the Community

Showing results for tags 'include'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 22 results

  1. Hello, I have the following code (which opens a database connection and then links to a table.) include("config.inc.php"); at the beginning of a script, but the file (which exists in the same directory as the script) is not being called. I have verified that the file is there and that the spelling is correct (there is no complaint for PHP not being able to read the file) Since it is not being read, the mysql search is not working. If I copy the lines from the config.inc.php file to this file, everything works. I have tried using the full directory structure to no avail. Any ideas? Thanks Steve
  2. I have the following three links in same page. http://localhost/folder/file.php?x=link1 http://localhost/folder/file.php?x=link2 http://localhost/folder/file.php?x=link3 i want to show URLs as they are... link1 is to include a file named "x.php" link2 is to include a file named "y.php" link3 is to include a file named "z.php" Can it be done in php only? PS: its not about creating hash ids. and i want to do it without any sql db connection.
  3. Hi, I have a cron job that executes this script every 2 minutes: <?php // LOAD WP-LOAD.PHP require('/opt/bitnami/apps/wordpress/htdocs/wp-load.php'); // INCLUDE AND EXECUTE SCHEDULER.PHP include('/opt/bitnami/apps/wordpress/htdocs/wp-content/themes/yeelloe/scheduler.php'); ?> When I try to include; /opt/bitnami/apps/wordpress/htdocs/wp-content/themes/yeelloe/scheduler.php: <?php // EXPLODE AND PARSE WP-CONTENT; FUNCTIONS.PHP $parse_uri = explode( '/opt/bitnami/apps/wordpress/htdocs/wp-content', $_SERVER['SCRIPT_FILENAME'] ); // LOAD WP-LOAD.PHP require_once( $parse_uri[0] . '/opt/bitnami/apps/wordpress/htdocs/wp-load.php' ); // LOAD TEMPLATE FUNCTION CheckFunction(); ?> I get the output: ): failed to open stream: No such file or directory in /opt/bitnami/apps/wordpress/htdocs/wp-content/themes/yeelloe/cron.php on line 5 PHP Warning: include(): Failed opening '<?php //PLEASE do NOT move me around. I get cranky when I get moved around //get the wp-load in for the wordpress functions $parse_uri = explode( '/opt/bitnami/apps/wordpress/htdocs/wp-content', $_SERVER['SCRIPT_FILENAME'] ); require_once( $parse_uri[0] . '/opt/bitnami/apps/wordpress/htdocs/wp-load.php' ); //now try calling template function CheckFunction(); ?>' for inclusion (include_path='.:/opt/bitnami/php/lib/php:/opt/bitnami/frameworks/smarty/libs') in /opt/bitnami/apps/wordpress/htdocs/wp-content/themes/yeelloe/cron.php Any ideas on how to execute this file. Any help would be appreciated.
  4. Hello All, I have been going crazy trying to figure this out, I hope someone can help me out I have header and footer.php files that on all my pages I get them to load with include, but for some strange reason, this certain page it will not load I did some research and apparently theres problems with div and php, does anyone know how to make this work? Thank you in advance, Elaine test.txt
  5. I need some help with this. I created an index.php page and I inserted an include statement that referred to a header.html page. It works when working it in MS Webmatrix but when I put it on my server I only get my index.php page. My include statement will not get the header.html page. What am I doing wrong? I also tried changing all of my files to .php extensions also and still the same. Here is my index.php file: <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>Braswell Electric</title> <link rel="stylesheet" href="braswellelectric.css"> </head> <body> <div> <?php include('/includes/header.html');?> <?php include('/includes/aside.html');?> <article class="About"> <header class="AboutHeader"> <h2>About Us</h2> </header> <p><b>Braswell Electric</b> is a family business owned and operated by Jim and Joyce Braswell located in Sylacauga, Alabama. Braswell Electris has been in business in Sylacauga for 25 years and covers the greater Talladega County area. We do new homes, remodels, or any small electrical issues you may have. We are licensed and insured and we are here for your residential needs.</p> <img src="pics/Coach Light.jpg" alt="Coach Light" > <img src="pics/Outside Plug.jpg" alt="Outside Plug"> <img src="pics/Service.jpg" alt="Service"> </article> </div> </body> </html> Here is my header.html file <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title></title> </head> <body> <header class="Header"> <h1 style="display: none">Braswell Electric</h1> <img src="pics/lightning1.jpg" alt="Header Pic"> </header> </body> </html>
  6. There is a function (that cannot be changed) which has an include: <?php function a() { include 'file.php'; echo 'work'; } ?> ==file.php== <?php echo 'play'; ## Need to leave a() now! ?> The included file can be changed. I would like a way for file.php to cause PHP to return out of the function a(). A return; statement in file.php has PHP pick up execution with the statement following include. What is there in PHP that will allow returning out of a() at some point in file.php?
  7. I'm having trouble including my navigation bar in my web pages using PHP. This is the script i have included in my web page, but it's not working. <?php include("navbar.php"); navBar(); ?> This is the script in navbar.php enclosing my navigation bar. <? function navBar() { ?> NAVIGATION BAR <? } ?> Help is appreciated.
  8. ok i have an index.php as so: <?php require 'php/stdlib.php'; $site->page->render(); foreach($page as $var => $value) { echo $var ." is ". $value." <br/>"; } ?> the obj creation for site and page is in the stdlib file and is obviously working cuz the -for each- loop prints out: name is welcome headers is inc/index_h.php footers is inc/index_f.php contents is inc/welcome.php It show that the object is created. I also did a var dump with proper results here is site---page---render: public function render_page(){ $this->page->render(); } here is page---render: public function render(){ include $this->headers; include $this->contents; include $this->footers; } however the result of the script is the following: Undefined variable: and also Trying to get property of non-object: both errors point to my $page object that i used in the include file for the page header: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title><?php echo $page->name; ?></title> <script src="/scripts/jquery.js"></script> </head> <body> The errors actually print out in the html title tag not on the screen meaning i have to use View Source on my browser to see it How do i get the $page object to be visible when using an include Im usually pretty good about finding answers myself but this thing has me stumped for two days now.(I have learned alot about many other things while searching for answer tho so I guess not all is lost) If anyone could help me I would greatly appreciate it. Probably should have added that the page and site object are instantiated in stdlib.php with the following $site = new csite(); site_ini($site); $page = new cpage("welcome"); $site->setPage($page);
  9. Hello there, I am trying to recreate a HTML website on a WordPress website. On the current website we pull a php file from the directory that lists brands for different catrogies. http://www.nongmoshoppingguide.com/brands/feed-and-seed.html We use the following script <!--?php <br ?--> <?php include('../lib/IphoneDataRenderer.php');?> <?php echo $IphoneDataRenderer->getAdsForBrandId();?> <!--?php } ?--> <?php $IphoneDataRenderer listBrandsForCategory(); ?> and it works fine for the website above. However, when I add this code within our WP website we don't get any information (I did add the /lib/iphoneDataRenderer.php files and folders). Could you help me understand what I am doing wrong? Many thanks!
  10. Hi - we're trying to attach a .pdf to an email and mail it to a client - not working -- here's the code - l'll highlight what I think I understand... =) I've inherited this php project and I'm in no way a PHP person though I can usually do minor fixes -- this is beyond me however. The owner of the site said that up until a year ago, this code was working. ps - I've tried incorporating swiftmailer and phpmailer but don't know how to configure those using this password verifying code and an "include" that's not a .pdf question - is this code fixable and if so, how? <?php orange = goes to database, verifies passwords, that the report was paid for, etc - oks access and sets the "to" email address as $i_email $i_get_sid = isset($_GET["sid"]) ? (int)$_GET["sid"] : $i_sid; $i_get_pass = isset($_GET["a"]) ? $_GET["a"] : $_SESSION['r_pass']; $i_get_pass = addslashes($i_get_pass); $i_qry1 = db_qry("SELECT * FROM reports WHERE sid={$i_get_sid} AND ispurchased=1 AND isenabled=1 AND passhash='$i_get_pass'") or die("Error: report-4, SQL request error #1 ".mysql_error()); if($i_qry1) { if($i_rec1=mysql_fetch_array($i_qry1)) { $i_fname = $i_rec1["fname"]; $i_lname = $i_rec1["lname"]; $i_email = $i_rec1["email"]; } db_free_result($i_qry1); } blue - imports the file where the pdf is generated using FPDF, gives it the variable $data and attaches(or embeds? - not sure) to the email if(!empty($i_email)) { ob_start(); include('inc/pages/report-3.inc.php'); $data = ob_get_contents(); ob_end_clean(); $data = wordwrap(base64_encode($data), 72, "\n", true); $i_boundary = '----------'.bin2hex(mhash(MHASH_MD5, time())); $i_headers = "From: oursite.com <info@oursite.com> green - sets the content of the email message X-Mailer: oursite.com PHP Mail (v1.0) Reply-To: oursite.com <info@oursite.com> X-Priority: 3 (Normal) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary=\"$i_boundary\""; $i_message = "--$i_boundary Content-Type: text/plain; charset=\"iso-8859-1\" Content-Transfer-Encoding: 7bit Dear ".$i_fname." ".$i_lname.", Here is the report you asked for, attached as an Adobe Acrobat document. If you do not already have one, an Adobe Acrobat reader can be downloaded for free at http://www.adobe.com/. ---- Best regards, Sports Team mailto:info@oursite.com --$i_boundary Content-Type: APPLICATION/PDF; name=\"report.pdf\" Content-transfer-encoding: base64 Content-Disposition: attachment; filename=\"report.pdf\" $data {$i_boundary}-- "; shows a new message in the browser to the user saying the emails been sent @mail($i_email, ' Sports - Your Report', $i_message, $i_headers); @mail('null@sight2k.com', 'Sports - Your Report', "ID - $i_get_sid", $i_headers); } header('Content-type: text/html'); $m_header = '<link href="shared/report.css" rel=stylesheet type="text/css">'; require_once($DOCUMENT_ROOT."inc/top-2.inc.php"); $i_get_sid = isset($_GET["sid"]) ? (int)$_GET["sid"] : $i_sid; $i_get_pass = isset($_GET["a"]) ? $_GET["a"] : $_SESSION['r_pass']; $i_get_pass = addslashes($i_get_pass); echo '<table cellpadding=0 cellspacing=0 border=0 width="100%">'; echo '<tr vAlign=top><td height=7><img src="images/1x1.gif" width=1 height=7></td></tr>'; echo '<tr height=28 style="background: url(images/bookm-bg.gif) repeat-x"><td width="100%"><nobr>'; echo '<img src="images/1x1.gif" width=5 height=1><a href="report.php?sid='.$i_get_sid.'&a='.urlencode($i_get_pass).'"><img src="images/bookm-42.gif" width=67 height=28 border=0></a><a href="report.php?sid='.$i_get_sid.'&a='.urlencode($i_get_pass).'&b=pdf"><img src="images/bookm-s3.gif" width=10 height=28 border=0><img src="images/bookm-52.gif" width=65 height=28 border=0></a> <a href="report.php?sid='.$i_get_sid.'&a='.urlencode($i_get_pass).'&b=/report.pdf"><img src="images/button-downloadpdf.gif" width=80 height=28 border=0></a> <a href="report.php?sid='.$i_get_sid.'&a='.urlencode($i_get_pass).'&b=email"><img src="images/button-emailpdf.gif" width=80 height=28 border=0></a>'; echo '</nobr></td><td><nobr><font style="font-size: 10px;"><a href="javascript:window.close();">Close Window</a> </font></nobr></td></tr></table>'; echo "<p> Thank you."; echo "<p> Your report has been successfully sent."; require_once($DOCUMENT_ROOT."inc/btm-2.inc.php"); // header("location: report.php?sid=$i_get_sid&a=".urlencode($i_get_pass)); ?> >>>>>The output is this instead of an email with attachment: ------------fd755da9fdf74bb9c832b8a95272fd4b Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Dear "client", Here is the report you asked for, attached as an Adobe Acrobat document. If you do not already have one, an Adobe Acrobat reader can be downloaded for free at http://www.adobe.com/. ---- Best regards, Sports Team mailto:info@oursite.com ------------fd755da9fdf74bb9c832b8a95272fd4b Content-Type: APPLICATION/PDF; name="report.pdf" Content-transfer-encoding: base64 Content-Disposition: attachment; filename="report.pdf" JVBERi0xLjMKMyAwIG9iago8PC9UeXBlIC9QYWdlCi9QYXJlbnQgMSAwIFIKL1Jlc291cmNl cyAyIDAgUgovQ29udGVudHMgNCAwIFI+PgplbmRvYmoKNCAwIG9iago8PC9GaWx0ZXIgL0Zs YXRlRGVjb2RlIC9MZW5ndGggMzE1Pj4Kc3RyZWFtCnicdVLLTsMwELznK+YIUnHtXTuxb0BL JbghIu6hpKgoaUqSgvr3rBNCAQlbstfemdnxg3CXaOUyfCTXOeYrA2OU1sg3uMmTN1jn4jL2 .....(goes on forever)
  11. I know what my problem is, but I'm not sure how to go about it. I am trying to include a php file with many includes (js, css, php) in another php file in a higher directory. I am using apache and run off localhost (this is an internal website). I have my main index /htdocs/index.php and the file I want to include. /htdocs/tables/php/projects.php When I include /php/projects.php in my index.php, as expected, all my links are broken to my js and css files, and even further nested php files (within js files). I believe I am supposed to DEFINE some kind of ROOT or DIR or something, but I am not having success Googling these things. Here is my code to look at: Index.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>BLST</title> </head> <body> <?php $projectsPage = "/tables/php/projects.php"?> <li><a href="index.php?page=<?php echo $projectsPage;?>">Projects</a></li> <?php if(is_null($_GET["page"])) { $page = ""; }else{ $page = $_GET["page"]; } include($page); ?> </body> </html> projects.php <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>Projects</title> <style type="text/css"> @import "css/test.css"; @import "http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.23/themes/smoothness/jquery-ui.css"; </style> <script type="text/javascript" language="javascript" charset="utf-8" src="js/jquery.min.js"></script> </head> The error being that any css, js or php file in projects.php is not found, as the browser reports it is looking for these files from the main root. I want to be able to alter this without trying to add something to projects.php.
  12. Hi I want to include a php file (basically my personal header) above the phpbb forum header. The file where I am inserting the code is "page_header.php" which is located in the includes folder. (file attached in this post). If I insert the following code: $root = realpath($_SERVER["DOCUMENT_ROOT"]); include "$root/top.php"; I get what I want but the font color of all the topics posted in the forum change from black to white (making it unreadable). How can I rectify this conflict and how is it happening? Thanks (I am new to php) page_header.php
  13. <html> <head> <!--title>Hello</title--> <link rel="stylesheet" href="uvcs.css" type="text/css" /> </head> <body> <div id=everything> <div id=header> This is the header </div> <div id=clear></div> <div id=navmenu> <div id=navmenu> <ul> <li> <a href="index.php?cmd=home">HOME</a> </li> <li> <!--submenu--> <a>VIEW</a> <ul> <li> <a href="index.php?cmd=student">STUDENT PROFILE</a> </li> <li> <a href="index.php?cmd=employee">EMPLOYEE</a> <!--subsubmenu--> <!--ul> <li> <a href=#>subsubmenu1</a> <a href=#>subsubmenu2</a> </li> </ul--> </li> </ul> </li> <li> <a href="index.php?cmd=courses">COURSES</a> </li> <li> <a href="index.php?cmd=aboutus">ABOUT UVCS</a> </li> <li> <a href="index.php?cmd=itsupport">IT SUPPORT</a> </li> <li> <a href="index.php?cmd=login">LOGIN</a> </li> </ul> </div> </div> <div id=clear></div> <div id=maincontent> <?php include("selector.php"); ?> </div> <div id=sidebar> side bar </div> <div id=clear></div> <div id=footer> Footer </div> </div> </body> </html> <?php $cmd =$_GET['cmd']; switch($cmd) { case 'home': include_once "home.php"; break; case 'student': include_once "student.php"; break; case 'employee': include_once "employee.php"; break; case 'courses': include_once "courses.php"; break; case 'aboutus': include_once "aboutus.php"; break; case 'itsupport': include_once "itsupport.php"; break; case 'login': include_once "login.php"; break; default: include_once "home.php"; break; } ?> These are my codes that supposedly would show home.php (which contains only the text "you are viewing home.php"), when you open the index.php. But for some reason I would get the line Notice: Undefined index: cmd in C:\xampp\htdocs\UVCSPortal\selector.php on line 2 you are viewing home.php I thought with these codes with would go directly to default case. But instead it reads the <?php include("selector.php"); ?> in index.php twice, I think. I tried using isset, but couldn't understand it.
  14. Hi, please, I have a strange problem... I do not know how to solve it, I'm trying for numerous hours... And sorry for my english. I prepared the following synthesis: --- All file in the server root of the web site contain only the statement: <?php require(’server/general.php’); ?> --- general.php basically read an external text file which contains the static html code for that web page identified by - $currentFileName = basename($_SERVER[’PHP_SELF’]); and then print his contents. (This approach allows a fluid management of central contents like the menu or links, particolar issues or appearance, and so on, through a file that contains some meta-informations about the site map) general.php concludes itself setting (in javascript) the html parameters (like input or hinnerHTML): <script> <?php $formParameter = isset($_POST[”u”]) ? $_POST[”u”] : ””; $x = ”xxx”; require(”server/”.$currentFileName); ?> </script> --- Let be that $formParameter isn’t a void value, for example it is ”Pippo”. In the file named ”server/”.$currentFileName, there are these statements: print $formParameter; print $x; // this invalidates javascript, but it is now for php debugging [and, correctly, ouput is: ”Pippo”, ”xxx”] if (!existingValue($x)) { print ”xxxxxxxxxxxxxxx”; writeLog(”x=_”.$x.”_”); clientMessage(...some parameter...); } [and, correctly, no output is done] if (!existingValue($formParameter)) { [And here there is the problem] print ”yyyyyyyyyyyyyyy”; // $formParameter = ”abcdef”; [now it is commented] writeLog(”formParameter is _”.$formParameter.”_”); clientMessage(...some parameter...); } After this if-statement, I print again the parameter: print ”after if: ”.$formParameter; --- prefixing that: 1# the soubroutine existingValue is only: function existingValue($T) { return ( trim($t)!=”” ); } 2# the soubroutine writeLog() write something in a text file 3# clientMessage() soubroutine postpones to a new web page, writing a message for the user , I see that: A# correctly, no print yyyyyyyyyyyyyyy in the last if-statement B# ?!?... writeLog executes! writing in the text file the string ”formParameter is __” C# correctly, not executes clientMessage() soubroutine D# then the flow of the program behaves as if it had never entered if, so it prints the string ”after if: Pippo”. Moreover, if after the statement - print ”yyyyyyyyyyyyyyy”; I uncomment - $formParameter = ”abcdef”; then output of B# became: ”formParameter is _abcdef_”. Why yyyyyyyyyyyyyyy isn’t printed (within the javascript code) but $formParameter is setted? Strange. The flow enters in the if-statement (but it should not do!) and does this only partially? --- Now, really, it isn’t a serious error because the program works equally (see point D#). But I need to understand why exists some aspect of the matter in which $formParameter is evalutated void, because I must make the check of client’s input Note: removing the include and carrying hits contents directly in the parent file (general.php), the problem disappears... but I cannot do this, because general.php has a general role, disconnected from a form-input. THANK YOU FOR YOURS ADVICES
  15. Hey guys, i am working for the first time on a localhost. at the moment i have an index file and i want to start splitting the page up to make this website dynamic. at first i tried to take my <head>.( <meta> / <title> tags , ) and include() them with a header.php file I am not sure if this is something i can even do or if my path is just not correct. i have my wamp on my C drive and its all through a www folder path. i then created an include file inside the www, where all files that i would use dynamically would be placed( header, footer, etc..) i tried two paths: include('include/header.php'); - didn't work i then removed the folder and had all the php files in one folder. include('header.php'); none of this works , the css of the page doesnt show up. i then replace the <head> info back inside the index, and all works fine. any suggestions ?
  16. Hi guys, I'm trying to build the following functionality, but find myself seriously lacking in coding aptitude and knowledge. I'm hoping you guys can help me out. Ultimate goal: Clean search bar in middle of screen with no submit button; typing specific text ex. "test" brings an html/javascript widget from a separate file ex. "test1.html" and includes that content below the search bar all without a refresh. My current solution (and note that the code is retrofitted from a different project that someone else wrote), is an if-then solution, whereby if the text in the input == "test" then the page includes the test1.html file. main.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Testing</title> <script language="javascript" type="text/javascript"> var XMLHttpRequestObject_test = false; var strSend; if (window.XMLHttpRequest) { XMLHttpRequestObject_test = new XMLHttpRequest(); } else if (window.ActiveXObject) { XMLHttpRequestObject_test = new ActiveXObject("Microsoft.XMLHTTP"); } var i; var finished; function test() { if (XMLHttpRequestObject_test) { strSend = "receive.php?"; i = 0; finished = false; while (finished != true) { if (document.input1.elements[i].type == "text") { strSend = strSend + "&" + document.input1.elements[i].name + "=" + document.input1.elements[i].value; } else if (document.input1.elements[i].type == "checkbox") { strSend = strSend + "&" + document.input1.elements[i].name + "=" + document.input1.elements[i].checked; } else if (document.input1.elements[i].type == "hidden") { strSend = strSend + "&" + document.input1.elements[i].name + "=" + document.input1.elements[i].value; } else if (document.input1.elements[i].type == "password") { strSend = strSend + "&" + document.input1.elements[i].name + "=" + document.input1.elements[i].value; } i = i + 1; if (document.input1.elements[i] != "[object HTMLInputElement]") { finished = true; } else { finished = false; } } XMLHttpRequestObject_test.open("GET", strSend); XMLHttpRequestObject_test.onreadystatechange = function () { if (XMLHttpRequestObject_test.readyState == 4 && XMLHttpRequestObject_test.status == 200) { document.getElementById('test').innerHTML = XMLHttpRequestObject_test.responseText; } } XMLHttpRequestObject_test.send(null); } } </script> </head> <body> <form name="input1"> <input name="txt1" type="text" /> </form><br /> <input name="cmd_submit" type="button" value="Submit" onclick="test()" /><br/> <br/> <div id="test"></div> </body> </html> receive.php <?php if($_REQUEST['txt1'] == "test") { include('test1.html'); } else { echo stripslashes($_REQUEST['txt1']); } ?> Test1.html (the content to be included) <?php echo '<script type="text/javascript" src="http://www.gmodules.com/ig/ifr?url=http://hosting.gmodules.com/ig/gadgets/file/100840413740199312943/stock-quotes.xml&up_stockList=%5EIXIC%2C%5EGSPC%2C%5EN225%2C%5EHSI%2C%5ESTI%2C%5EFTSE%2C%5EGDAXI%2C%5EFCHI&up_chart_bool=1&up_font_size=12&up_symbol_bool=0&up_chart_period=0&up_refresh_secs=30&synd=open&w=290&h=300&title=Stock+Quotes&border=%23ffffff%7C3px%2C1px+solid+%23999999&output=js"></script>'; echo '<p class="p1">ONETEST!</p>'; ?> Result after typing "test" into search bar (no quotes) [SEARCH BAR] ONETEST! Very accurate representation of the search bar, I know. But the google widget that I used to test this doesn't show up, only the text. I have tried many variations on trying to echo the javascript such that php doesn't chuck it, but nothing. // I have alternative code that includes the content via ajax without the use of php and it brings the widget in without a problem, however, I have no idea how to make that "search bar - if string == 'test', then, show include" paradigm without php. Thank you in advance, Alex Long time visitor, first time poster
  17. Hello, I'm working on a project where I would like to load the contents of one webpage (that I'm not hosting) into a webpage that I am hosting with the ability to access the DOM of the non-hosted page. What I would like to do is load a different page (GUI for an internal system) within my own webpage, and then be able to select elements within the GUI using jQuery and add CSS styling to them. I figured iframes would be the easiest way to handle this, but then learned about the Same Origin Policy, which denies access to the DOM of a non-hosted page in the iframe. So then I tried using a PHP Include statement to load the GUI within my page. I've run in to 2 roadblocks with this method: The first is that when I tested this method using google.com as the included site, as soon as you click on a link, it takes you outside of my site and on to google. I'll definitely need the ability for users to click around within the GUI but still remain within my site. The 2nd issue I'm having is simply including the GUI since it's web address is an IP Address. I keep getting the following error: Warning: include() [function.include]: Failed opening 'http://192.168.1.xx' for inclusion (include_path='.:/usr/local/lib/php') in /home1/public_html/example.com/example.php. If anyone has any advice as to whether it's possible to acheive this, I'd love to hear some feedback. Maybe PHP isn't even the answer. Maybe I'm going about this all wrong. I'm definitely open to any suggestions at this point! Thanks for reading, DJS
  18. Hi all, So I have a page which uses mysql_query to select some variables from a table, and then produces an array in order to plot this information on a graph (data used for this depends on the unique id which is obtained by $_GET [‘mrn’]. This is all working fine. However, what I want to do now is include multiple copies of these graphs on a single page (graphs for different mrn’s). I tried to do this by including the files like this: <php $_GET[mrn] = "1"; include('graph.php'); ?> //some html <php $_GET[mrn] = "2"; include('graph.php'); ?> The problem with this method has been that although it works once, the second you include a second graph it stops working (presumably because I have tried to assign two different values to the same variable by effectively defining it twice?) My question is therefore, is there some way to include a file, get its output (draw its graph), and then stop including it, so that I can start including the next file (drawing next graph). My reading so far has led me to believe there probably isn’t a way? Am I correct about that? Does anyone have any ideas about how I might get this working using a different technique? Thanks in advance for any help, Matt
  19. Yeah, godaddy skewed me. I got upgraded from php 4 to 5 and the external include will no longer work. Well I tried/put the include file into the root folder and still nothing. The errors are at thefastesthorse.com I don't know much about php coding, and just trying to get this back up and running *********************** Warning: include() [function.include]: URL file-access is disabled in the server configuration in /home/content/88/10840488/html/thefastesthorse/index.php on line 96 Warning: include(http://www.thefastesthorse.com/syndication/folder1/top1.html) [function.include]: failed to open stream: no suitable wrapper could be found in/home/content/88/10840488/html/thefastesthorse/index.php on line 96 Warning: include() [function.include]: Failed opening 'http://www.thefastesthorse.com/syndication/folder1/top1.html' for inclusion (include_path='.:/usr/local/php5/lib/php') in/home/content/88/10840488/html/thefastesthorse/index.php on line 96 ***************************** Any help will be greatly appreciated. Thanks, Dave
  20. I have a problem and all search results suggestions do not word. My site has some 400 pages and all the article pages have this code that causes an error. The site is running on Godaddy's lenux server. To see the error go to my web site weddings and wedding planning plus com and select "Enter" and look at the bottom of the page and also from there select an article and see the same error at the bottom... All the other includes in the"Includes" folder work fine including Adsense, Amazon and others, except this one.... This is the code that's near the bottom of all the articles page coding.... <tr> <td colspan="3"> <?php include("$Domain/Includes/NewsFeed.php?CAT=$NewsFeed"); ?> </td> </tr> This is the error message appears at the bottom of all articles. See below for the include file content of NewsFeed.php.. Warning: include() [function.include]: URL file-access is disabled in the server configuration in /home/content/o/r/e/orendon/html/weddingsandweddingplanning/Articles/Free_Wedding_Vows.php on line 70 Warning: include((URL address blocked: See forum rules)//Includes/NewsFeed.php?CAT=Weddings) [function.include]: failed to open stream: no suitable wrapper could be found in /home/content/o/r/e/orendon/html/weddingsandweddingplanning/Articles/Free_Wedding_Vows.php on line 70 Warning: include() [function.include]: Failed opening '(URL address blocked: See forum rules)//Includes/NewsFeed.php?CAT=Weddings' for inclusion (include_path='.:/usr/local/php5/lib/php') in /home/content/o/r/e/orendon/html/weddingsandweddingplanning/Articles/Free_Wedding_Vows.php on line 70 This is the include in the Includes folder named NewsFeed, file NewsFeed.php ...... ========================================== <?php error_reporting(0); $CAT = $_GET['CAT']; $CAT = str_replace(" ", "+", $CAT); $QTY = 10; //$_GET['QTY']; $url = "(URL address blocked: See forum rules)=<keywords>"; $url = str_replace("<keywords>", $CAT, $url); print "<ul class='ulCategory'>"; flush(); class SimpleXmlParser{ var $SimpleParser; var $feedUrl; var $title = ""; var $description = ""; var $link = ""; var $author=""; var $pubDate=""; var $insideitem = false; var $tag = ""; var $count_results = 0; var $total_results = 0; function SimpleXmlParser($MyFeed, $results) { $this->total_results = $results; $this->SimpleParser = xml_parser_create(); $this->feedUrl=$MyFeed; xml_set_object($this->SimpleParser,$this); xml_set_element_handler($this->SimpleParser, "XmlParserFirstElement", "XmlParserendElement"); xml_set_character_data_handler($this->SimpleParser, "characterData"); $this->ParseFeed(); // Call to Parser Function } function XmlParserFirstElement($parser, $tagName, $attrs) { if ($this->insideitem) { $this->tag = $tagName; } elseif ($tagName == "ITEM") { $this->insideitem = true; } } function XmlParserendElement($parser, $tagName) { //The Function Will be called, when ever the XML_PARSER Encounters a end Tag, in the XML File if ($tagName == "ITEM") { if ($this->count_results < $this->total_results) { print "<li>"; print " <a target=_new href=\"http://" . $this->link . "\">"; print htmlspecialchars(trim($this->title)); print " </a><br><br>"; print htmlspecialchars(trim($this->description)) . "<br>"; print "</li><br>"; $this->title = ""; $this->description = ""; $this->link = ""; $this->insideitem = false; } $this->count_results = $this->count_results + 1; } } function characterData($parser, $data) { if ($this->insideitem) { switch ($this->tag) { case "TITLE": $this->title .= $data; break; case "DESCRIPTION": $this->description .= $data; break; case "LINK": $this->link .= $data; $pos = strpos($this->link, "*"); if (!($pos === false)) { $this->link = substr($this->link , $pos + 1, 300); } $this->link = trim($this->link); $pos = strpos($this->link, "//"); if (!($pos === false)) { $this->link = substr($this->link , $pos + 2, 300); } break; } } } function ParseFeed(){ $data = file_get_contents($this->feedUrl); xml_parse($this->SimpleParser, $data); xml_parser_free($this->SimpleParser); } } $XMLpar = new SimpleXmlParser($url, $QTY); print "</ul>" ?> ======================================= Thanx, orendon
  21. Hi everyone ! I'm new here... So I got a little problem with creating my first website. I want to include files with the content of my subpages to the main index file. At the first I made a simple solution with switch. Where the urls to the files in the menu look like: href="index.php?page=1" than "page=2" and so on and the code in the place of subpages content was: <? switch ($_GET['page']) { case 2: include("/subpages/aboutme.php"); break; case 3: include("/subpages/a=gallery.php"); break; case 4: include("/subpages/movies.php"); break; case 5: include("/subpages/contact.php"); break; case 1: default: include("/subpages/main.php"); } ?> Of course this solution was correct and it was working BUT what about when someone change the url to the ..."index.php?page=10000000" just because being curious and to check what will happen (there isn't any site with the sign "The page you're looking for cannot be found") and the other reason why I want to upgrade my include solution was that I have to add another cases every time when I want to make another subpages. So I decided to change it and my new url code in menu looks like: href="index.php?page=aboutme" or href="index.php?page=gallery" (so after equal sign there is an exactly name of my subpage without ".php") and than the code which includes my content is: if (file_exists('subpages/' . $page . '.php')) { require('subpages/' . $page . '.php'); } else { echo '<div id="main"><span>The page you’re looking for cannot be found.</span></div>'; } where the $page=$_GET['page']; It is working too but only when I click on one of the subpages in my menu but what about default like in the switch solution? I mean the case when I go to my site typing url without selecting any subpage. Now there is just the sign "The page you're looking for cannot be found." My other question is that I want to add a guestbook which is in the other folder in subpages so the url is "subpages/guestbook/gbook.php". What should I change in my code which works only for the subpages folder? I try to do something like this but it doesn't work: if ($page='gbook' && file_exists('subpages/guestbook/' . $page . '.php')) { require('subpages/guestbook/' . $page . '.php'); } elseif ($page!='gbook' && file_exists('subpages/' . $page . '.php')) { require("subpages/' . $page . '.php'); } else { echo '<div id="main"><span>The page you’re looking for cannot be found.</span></div>'; } Sorry for the length of this topic but I want to avoid unnecessary questions and useless solutions and I want apologies for my English but I'm 17 and I'm from Poland so I've been still learning it !
  22. I'm new here and looking for help with a problem (already tried googling it, though I'm not sure I'm even explaining it correctly). The only file visible to the user is this <?php include "../../the-actual-site/index.php"; ?> The rest of the site is behind the "www" folder, and uses includes, get, and session, variables to navigate the pages. Now I want to add some javascript to the display pages, but some nasty things are happening when i do, i trimmed everything down to a bare example (just to make sure something else was not interfering), but these problems still persist. So for the example page I have setup the index.php in the www folder the same way, and used the page from this tutorial as a working example. The tutorial pages work fine if laid out as instructed, or renamed/moved around (but not included). So the first problem is that that the javascript requires me to expose the "index.php" part of the url to send a get variable. (I trued outputting just the "?var=" part, and it did not work) The production site never exposes this, and while I don't believe it would cause an issue, I would rather keeps things "as-is" than having people freak out over it. The second issues is that the javascript is making the page display twice once it starts working. Another instance of the page is created below the first one (the second is non-functional). So first, how can I use js in an include without the page duplicating? And second how do I get javascript to output clean GET variables without showing the "index.php" part?
×
×
  • 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.