PHP - Getting The Value Of A Php Document
Ive tried
<?php $file = file_get_contents('./time.php'); echo $file; ?> This just outputs the php, how can I make it just the out php output value. ty in advance. Similar Tutorialsim using dom to tidy up my html but i wondering is there a way to format my html like so
<dl> <dd> <label>Condition :</label> <select name="condition"><option value="New">New</option> </dd> </dl>insead of <dl> <dd> <label>Condition :</label> <select name="condition"><option value="New">New</option> </dd> </dl>here is the php im using $dom = new DOMDocument(); $dom->loadHTML($this->_body); $dom->formatOutput = true; echo $dom->saveHTML();thank you Hi Folks, I am trying to scrape the price data from a webpage, but how to get the variable, see here the target http://www.buergerstiftungen.de/cps/rde/xchg/SID-635E10F9-BFA1A4BF/buergerstiftungen/hs.xsl/db.htm Code: [Select] include 'simple_html_dom.php'; $html1 = file_get_html('http://www.buergerstiftungen.de/cps/rde/xchg/SID-635E10F9-BFA1A4BF/buergerstiftungen/hs.xsl/db.htm'); $info1 = $html1->find('b[class=[what to enter herer ]',0); The variable then also contains data such as <b class="info"> info </b> Is there a way to trim the unwanted data out ? I just need all the infos out of the site. I am unsure if I do it during the find, or perhaps when i echo out the variable, then do I specify what I want ? well how t o do it witout a regex but with DOM-Document!? so I want to know how I could upload a document associated with an event.......with a form upload.......but where do I store it at and make it display in the view page for the event......? I'm using a here document for the html in my php page. In it I call a function to get the correct value to pass to the form and eventually to the next php page. I'm getting an error:Array to string conversion in. I'm not sure why, maybe I'm escaping the double quotes wrong? or do you need to do something special when the value being submitted is an array?
This line is where the error is, the second table data in the first table row
<td><input name="choice" type="radio" value=\"getCardValues($pyramid, 0,0)\" /></td>in here $output =<<< _HTML_ <!DOCTYPE html> <html> <head> <title>Pyramid Solitaire</title> </head> <body> <div class="main"> <h1>Rock Paper Scissors Game</h1> <form action="rps.php" method="post"> <input type="text" name="name"> <input type="hidden" name="past" value="0"> <table width="20%"> <tr> <td><img src="./images/cards/getCardFile($pyramid, 0,0)" width="100" height="100" /></td> <td><input name="choice" type="radio" value=\"getCardValues($pyramid, 0,0)\" /></td> </tr> for($i = 0; $i < 2; $i++) { <tr> <td><img src="./images/cards/getCardFile($pyramid, 1,$i)" width="100" height="100" /></td> <td><input name="choice" type="radio" value="getCardValues($pyramid, 1,$i)" /></td> </tr> }and so on... This is the function being called: function getCardValues($array, $row, $col) { $valuesHolder = array($array[$row][$col].getFace(), $array[$row][$col].getSuit()); return $valuesHolder; } Edited by 0rangeFish, 11 December 2014 - 01:25 AM. Hey y'all.
I'll gladly admit that I'm not a server guy - I have the utmost respect for people comfortable enough with *nix to handle Apache setup and configuration in a production environment. I can noodle about in *nix typically without killing anything vitally important, but trust me when I say no-one wants me to be a server administrator. That having been said, I do have a development server behind my home network firewall running Ubuntu that I use to test and develop the sites that I create on my separate Windows box. So I try to keep up with the way a shared server would be set up in a real-world situation, to a degree. For instance, I haven't bothered setting up the mail server or FTP, but I do create virtual host files for each of my projects.
So, I've got a virtual host set up on the directory /var/www/myAwesomeSite.com/ with the .conf file containing the following configuration:
<VirtualHost *:80> ServerAdmin webmaster@localhost ServerName myAwesomeSite.com DocumentRoot /var/www/myAwesomeSite.com/www <Directory /var/www/myAwesomeSite.com/www> AllowOverride All </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>Now, in my php scripts echoing out $_SERVER['DOCUMENT_ROOT'] gives me 'myAwesomeSite/www' as I would expect. And using $_SERVER['DOCUMENT_ROOT'] in any require() statements actually does include the requested file, so that part seems to be working fine. My question is this: when I use a leading slash ('/'), shouldn't that equate to the document root? I use it at work all the time and it works flawlessly, but on the dev server I have set up here, it's a no-go. Is there another config command that I need to issue to make it work, or am I crazy? Basically, am I missing a setting somewhere that will make this: require_once('/path/to/my/include.php');work like this? require_once($_SERVER['DOCUMENT_ROOT'].'/to/my/include.php');*edit* I just realized that I used the wrong slash in the title of this post, but I don't see a way to change the topic title. crap. Edited by maxxd, 23 November 2014 - 11:20 AM. This upload form code works successfully, where a file is chosen, renamed and stored in the 'upload' folder, This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=354333.0 how do I make document upload fields like the ones that are on this website where there is a link at the bottom to make another field appear, or make it so that a new field automatically appears when the first one has info in it. Does this make sense? and also how would i make these submit with the form seeing as that they would have different field names, wouldn't they? Hi everyone. I have been looking for a PHP upload script that handles various different document types like PDF, DOC and XLS. So far all I have found is image upload scripts. Can anyone point me in the right direction? I would be most greatful. Thank you! Hi all, I can't get this code to work, if you can tel me what I am doing wrong I would be gratefull. This is my XML file: Code: [Select] <?xml version="1.0" encoding="UTF-8"?> <popis> <student> <prezime>Brkic</prezime> <ime>Ivica</ime> <index>D-142</index> </student> <student> <prezime>Cizek</prezime> <ime>Pero</ime> <index>D-143</index> </student> </popis> This is the form I wanna use to change nodes: <form action="zamjena.php" method="post" enctype="multipart/form-data"> <table> <tr> <td colspan="2"class="labelcell"><label for="ime">Ime:</label></td> <td colspan="2"class="fieldcell"><input type="text" id="ime" name="ime" tabindex="1"/></td> </tr> <tr> <td colspan="2"class="labelcell"><label for="prezime">Prezime:</label></td> <td colspan="2"class="fieldcell"> <input type="text" id="prezime" name="prezime" tabindex="2"/><br /> </td> </tr> <tr> <td colspan="2"class="labelcell"><label for="index">Index:</label></td> <td colspan="2"class="fieldcell"> <input type="text" id="index" name="index" tabindex="3"/> <br /> </td> </tr> <tr> <td colspan="2"class="labelcell"><label for="index">ID:</label></td> <td colspan="2"class="fieldcell"> <input type="text" id="id" name="id" tabindex="4"/> <br /> </td> </tr> <td colspan="4"><input type="submit" name="upload" class="box" value="Zamjeni" tabindex="5" /></td> </table> </form> "id" is the mark which node to change And this is code for changin nodes, I found it on: http://us.php.net/manual/en/domnode.replacechild.php : <?php // Create a new document fragment to hold the new <student> node $student = new DomDocument; $student_node = $student ->createElement('student'); // Add some children $student_node->appendChild($student->createElement('ime', '$_POST['ime']')); $student_node->appendChild($student->createElement('prezime', '$_POST['prezime']')); $student_node->appendChild($student->createElement('index', '$_POST['index']')); // Add the keywordset into the new document // The $student variable now holds the new node as a document fragment $student->appendChild($student_node); ?> Next, we need to locate the old node: <?php // Load the XML $dom = new DomDocument; $dom->loadXML($xml); // Locate the old student node $xpath = new DOMXpath($dom); $nodelist = $xpath->query('/popis/student'); $oldnode = $nodelist->item($_POST['id']); ?> We then import and replace the new node: <?php // Load the $student document fragment into the current document $newnode = $dom->importNode($student->documentElement, true); // Replace $oldnode->studentNode->replaceChild($newnode, $oldnode); // Display echo $dom->saveXML(); ?> thanks for help I've been using php for a while now to create forms, up until now i've always transmitted the form data to a new php document that then processes them. I wanna take this to the next level and start trying to process the data within the same document. I know this has something to do with checking if the submit button is pressed and then processing the submitted data but thats about as far as my knowledge goes. Can anyone help me out on how i can achieve this type of thing. The reason is that i've found a way to execute php code within a joomla 1.6 environment without having to use the iframe option. I know the iframe option may be easier in a way of doing things but its out of the question. The final fase of the php will output code that will trigger a specific joomla plugin to do some specific action. If i pull a php document via an iframe the plugin doesnt trigger as it only gets triggered after the joomla "afterRender" (or something" has executed. If i use the iframe option then that rendering never gets used so the plugin doesnt get triggered. So in a nutshell, i wanna create forms that submit data and that data gets processed in the same document (in this case joomla article). How do i go about doing this. Hello, I had created a form for users to upload their resumes (only word documents & 1 MB allowed as size), then email it after its been successfully uploaded. Any help? Thanks in advance I would like to store weekly reports into documents. I am familiar with storing data to a regular text document, but it does not keep bold text, tables and so forth. Are there any other documents that would not be to hard to output to such as .pdf, .rtf, .doc, etc.? I've attached the current format we are using in excel. Now that I have things automated in php, I would like to output to a document with almost identical formatting. And how can I keep it on 8 1/2" x 11" pages without it splitting data or tables between two pages? Thanks, Jake Howdy,
So I am creating a website with SQLite and this time I decided to follow the rule of putting the SQLite DB outside of the document root. However, the admin would need to admin, basically, the DB, so I have two choices:
a) Put PhpLiteAdmin (The SQLite DB manager like PHPmyAdmin is for MySQL) in the document root while giving it a path to the actually DB that is outside of the document root;
b) Set a subdomain to a directory outside of the document root of course and put both PhpLiteAdmin and the SQLite DB there and the admin would access it like this - db.Awesome-Website.com;
Which one of those two options are safer?
Thank you very much!
I've been using the exslt document tag in an XSLT template for a while. Something like <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" xmlns:date="http://exslt.org/dates-and-times" extension-element-prefixes="exsl date"> <xsl:output method="text" /> <xsl:template match="/Schema/Table"> <exsl:document href="a.b" method="text"> A </exsl:document> </xsl:template> </xsl:stylesheet> Suddenly it's stopped working with [Fri Feb 10 20:49:25 2012] [error] [client 192.168.122.1] PHP Warning: XSLTProcessor::transformToXml(): File write for a.b refused in /var/www/gen/genX/GenModelClass.php on line 72, referer: http://192.168.122.35/gen/genMenu.php [Fri Feb 10 20:49:25 2012] [error] [client 192.168.122.1] PHP Warning: XSLTProcessor::transformToXml(): runtime error: file /var/www/gen/genX/GenModelClass.xsl line 9 element document in /var/www/gen/genX/GenModelClass.php on line 72, referer: http://192.168.122.35/gen/genMenu.php So I assumed that it was write permissions to the directory it was using, but using fopen will create the file. Even if I specify the file as file:///tmp/a.b doesn't work. ( I'm using Ubuntu as the server ). Is there a working example out there which I could try and see if there is something wrong with my setup - or does someone know what's happening? Hi folks, Need some help with my php website. My website has provision for users to upload their documents (doc or pdf mainly). I want to have the ability to open those documents from my admin login, directly on the webpage in a standard format, and review the document and comment on it. I want to able to use highlighting and stickies to critique the uploaded document. Any pointers? Much appreciated, Jen How can i read this kind of xml document using simple xml.I have not seen such format and i need some clues on what to do. Code: [Select] <?xml version='1.0' encoding='UTF-8' standalone='yes' ?> <?xml-stylesheet type="text/xsl" href="sms.xsl"?> <smses count="2"> <sms protocol="0" address="0800000" date="1328814938421" type="2" subject="null" body="Its raining cat and dogs;and their owners." toa="null" sc_toa="null" service_center="null" read="1" status="-1" locked="0" date_sent="null" readable_date="Feb 9, 2012 10:15:38 PM" contact_name="Hans Petit" /> <sms protocol="0" address="+2273839309" date="1329194575094" type="1" subject="null" body="Take it easi" toa="null" sc_toa="null" service_center="+4422500000" read="1" status="-1" locked="0" date_sent="null" readable_date="Feb 14, 2012 7:42:55 AM" contact_name="Miguel" /> </smses> I am using php require to input a page of code. I am including (require) that file several times within the page. I am guessing that it executes the file every time, and does not save any page loading time, and in fact probably slowing it down because it has to make the request every time.
Just wanted an expert to confirm or deny my educated guess. Would it be the same if it were including an html file instead of a php file?
<?php require ("$base_path/main_page_rotation/content4.php"); ?> I am trying to populate a textarea with the text up to the first <br> tag in a html editor using the code below.
<script> function setIntro_en() { var title = document.getElementById('mtxStory_en').html(); alert (title); var title = title.split('<br>')[0]; alert(title); <!--document.getElementById('mtxIntro_en').value = title; --> } </script>I am getting an error saying 'document.getElementById(...).html is not a function' This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=334078.0 |