PHP - Moved: Opening More Then One Tab
This topic has been moved to Other.
http://www.phpfreaks.com/forums/index.php?topic=349781.0 Similar TutorialsThis topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=317921.0 Hey guys, I've been searching the forum, but haven't found a post describing the following problem: I want to Open and Manipulate a word document using the COM class. This is my code so far: $Wrd = new COM("Word.Application"); $DocName = TEMPLATE_DIR.'template.doc'; $Wrd->Application->Visible = True; $WrdDoc = $Wrd->Documents->Open(realpath($DocName)); # do something here $WrdDoc->SaveAs(realpath($DocName)); $Wrd->ActiveDocument->Close(false); $Wrd->Quit(); $Wrd = NULL; There's no problem creating the COM-object, but when i try $WrdDoc = $Wrd->Documents->Open(realpath($DocName)); the browser is either complaining about insufficient memory or will chew on the code for ages... I can see that a temporary word file is created, so it seems that the document has been opened... still, the browser is working and working.... can anyone tell me what's going on? Many Thanks! Hi, I'm migrating a site from PHP4 (4.4.6) to PHP5 (5.3.5), am replacing all short open tags, and have many '<?=' opening tags to migrate as well. I saw a reference in the online docs about an equivalent '<?php=' tag, but it doesn't appear to work. What is the best way to 'find and replace' a PHP4 snippet like '<?= $var ?>' into a PHP5, non-short-open-tag equivalent? thanks, Barry I have a page that will sort my DB table by name and telephone number. And it has a button. I want visitors to be able to input a last name, and have the telephone number provided in a SEPERATE and NEW window after they click the button. Any suggestions for best procedure? My two initial concepts a 1- Make this a form, with the "action" leading to a file like SELECT *FROM myTable WHERE last name="$inputname" and have then use Javascript ONSUBMIT to open a NEW window. (not sure it will succeed as I desire) 2- Make this a simple BUTTON with Javascript pointing everything to the file to process the quiery. PS: I've heard IE doesn't always handle "_BLANK" properly, and I'm unaware of a PHP method. Haven't thought it through entirely, so I'm looking for pointers and advise. I'm planning on writing a library script holding pdf files which will serve the purpose as ebooks in which people could search and open. I don't know for sure, but doubt that you can open a pdf file and make it readable in php. I've noticed adobe reader has managed to do it, and what method do they use to do so? Hey all, I'm just having a problem with this code.. the local server says it has an error on a particular line that will be pointed out in the coding section. Code: [Select] <?php $hd = fopen('content.txt', 'r'); $line = fgets($hd); $content = array(); while($line) { $word = explode(',', $line); $content [$word[0]] => array('img_path' => $word[1], 'description' => $word[2], 'price' => $word[3]); // the error message is indicating this line is broken!! Is it because of an equal sign missing? I tried putting an equal sign, but still it doesn't run. $line = fgets($hd); } fclose($hd); ?> Your help is greatly needed.. Hi there, I am new to PHP and trying to put my learning together as I progress. Here's the problem: I would like to open HTML file after a certain condition is met. I tried to fopen() but it gave an empty page. Here's the code: Code: [Select] <?php $shape = $_POST['shape']; if($shape=='Triangle') { fopen('ogc_show_triangle.php', 'r'); } else { echo "Select a shape."; } ?> Thanks in advance! ^_^ Hi. I am working with some rather large files. Sometimes I am just opening a file and trying to find an entry on a single line. Sometimes I am opening a file and working on each line.
Whats the most efficient way to work with a large file?
If I open a file, and place all lines into an array, I will use a lot of memory.
If I open a file, and work on it line by line, I should use much less memory, but will the process take longer?
Whats most efficient?
I have underlined my main question above.
Thanks :-)
if (!file_exists('../images/flags/imNum.txt')) { $file1 = fopen('../images/flags/imNum.txt','c'); fclose($file1); } why won't that work =\ it makes no sense to me Hi everyone
As a new member I am impressed with the response and how helpful folk are, thanks in advance . I am trying to figure out if I can open a html modal window as soon as a link is clicked.
e.g.
web url link (click this modal window opens in the centre of screen with the results of the query) I don't want to show any info in the toolbar just results of the query ? can this be possible, an example would be handy to see the mechanics of it, are there any browser issues with this ?
thanks again ...singhy
Warning: include(): Failed opening 'lang/en.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/name/public_html/db/config.php on line 13What does the for inclusion mean. Line 13: include 'lang/'.$_SESSION['default_lang'].'.php';Thank you. There are no opening and closing tags in the code example of the file PostsController.php in this tutorial:
http://book.cakephp....g/part-two.html
Should I always use opening and closing PHP tags throughout with CakePHP? Hello, everyone. I have code that effectively calls a PHP page with AJAX (no JQuery). The PHP responds fine with an echo. Here is the javaScript that calls the PHP so refreshing the page doesn't need to be done.
function deleteCategory() { var e= document.getElementById("dropDown1"); var var1 = e.options[e.selectedIndex].text; var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = alerta() { if (this.readyState == 4 && this.status == 200) { document.getElementById("insert").innerHTML = xmlhttp.responseText; } }; xmlhttp.open("GET", "deleteRow.php?q=" + var1 , true); xmlhttp.send(); } How do I call a PHP function on the same page while preserving the above AJAX.
Sincerely, Joshua The code is for generated a home page with two div's: 'left_menu' and 'right_menu', where I want to navigate with the links from left_menu should display the content on the right_menu. I have two links (reports and roles) on the left_menu and two tabs (tab1 and tab2) on the right_menu. 1. When I click on reports, it should open the tab1 and clicking on users should open the tab2. 2. When I launch home.php, the first item(reports) should be opened by default and the tab1 accordingly. Here is the my code I tried, when I click the roles on left_menu, it is opening the default one i.e. tab1 and the left_menu isn't opened by default. home.php <html lang="<?php echo _SITE_LANGUAGE ?>"> <head> <script src="../js/jqueryv1.10.2.js"></script> <script type="text/javascript"> //accordion left menu $ (document).ready(function() { $ (".wings").click(function(event) { $(".box").slideUp("slow"); if ($(this).next().is(":hidden") == true) { $(this).next().slideDown("slow"); } }); //(".box").hide("slow"); }); //Tab (rightbox) $(document).ready(function() { $('#tabs li a:not(:first)').addClass('inactive'); $('.contain').hide(); $('.contain:first').show(); $('#tabs li a').click(function() { var t = $(this).attr('id'); if($(this).hasClass('inactive')) { //this is the start of our condition $('#tabs li a').addClass('inactive'); $(this).removeClass('inactive'); $('.contain').hide(); $('#'+ t + 'C').fadeIn('slow'); } }); }); </script> <style> .wings { width:200px; float:left; padding:7px 11px; } .box { width:195px; float:left; display:none; margin:0px 20px; } </style> </head> <body> <?php echo '<div class="left_menu"> <div class="wings"> <div style="float:left;"><img src="images/right_arrow.gif"/></div> <div style="float:left;padding:0px 7px;"><a href="display.php"><a href="report.php">Reports</a></div> <div style="float:right;"><img src="images/downarrow.png" style="width:17px;height:17px;cursor:pointer;"/></div> </div> <div class="box">'; $reports = $reports->get_report(); $reports_count = count($reports); if ($reports_count > 0 ) { foreach ($reports as $ds) { echo '<div style="float:left;margin:5px 14px;width:180px;"> <div style="float:left;"><img src="images/right_arrow.png"></div> <div style="float:left;padding:0px 6px;">'.$ds['dsource_name'].'</img></div> <div style="float:left;"><a href="edit_dsource.php?id='.$ds['id'].'"><img src="images/edit.gif"/></a></div> <div style="float:left;padding:1px 2px;"><img src="images/not-available.png"/></div> </div>'; } } else echo 'No Datasources'; echo '</div> <div class="wings"> <div style="float:left;"><img src="images/right_arrow.gif"/></div> <div style="float:left;padding:0px 7px;"><a href="display.php"><a href="report.php">Roles</a></div> <div style="float:right;"><img src="images/downarrow.png" style="width:17px;height:17px;cursor:pointer;"/></div> </div> <div class="box">'; $roles = $roles->get_report(); $roles_count = count($roles); if ($roles_count > 0 ) { foreach ($roles as $ds) { echo '<div style="float:left;margin:5px 14px;width:180px;"> <div style="float:left;"><img src="images/right_arrow.png"></div> <div style="float:left;padding:0px 6px;">'.$ds['dsource_name'].'</img></div> <div style="float:left;"><a href="edit_dsource.php?id='.$ds['id'].'"><img src="images/edit.gif"/></a></div> <div style="float:left;padding:1px 2px;"><img src="images/not-available.png"/></div> </div>'; } } else echo 'No Datasources'; echo '</div>'; echo '</div> <!--left_menu-->'; echo '<div class="right_menu"> <ul id="tabs"> <li><a id="tab1">Configuration</a></li> <li><a id="tab2">Report Viewer</a></li> </ul> <div class="container" id="tab1C"> <div id="content" style="padding-left:35px;"><h3><font color="brown"> </font><br> ( Report Tab content ) </div> </div> <div class="container" id="tab2C"> <div id="content" style="padding-left:35px;"><h3><font color="brown"> </font><br> ( Report Tab content ) </div> </div>'; echo '</div><!--right_menu-->'; ?> </body> </html> JS Fiddle : http://jsfiddle.net/gansai/s9NvX/1/ Hi.. I have an issue on my project.I want to open a particular page of a PDF file by clicking a hyper link.How should I do it?any idea ? I used the following code <?php header("Content-Type: application/pdf"); $pdfFile="readme.pdf#page=10"; ?> <html> <head> <title>Untitled Document</title> </head> <body> <a href="http://<?php echo $pdfFile; ?>">Click Here</a> </body> </html> But it showing an alert like following File does not begin with '%PDF-' After clicking alert showing a black screen.. can u please send me the entire code? Thanks... Hi guys, I know that you can open web page with $handle = fopen("http://www.example.com/", "r"); but i am wondering is there a way to pass POST vars when doing so, or there is another method that can that like you do it with ajax. I have mvc application that i want to test. I am using CodeIgniter framework so i want to call my controllers with POST values. Every controller method returns data holder object that holds the data of operation whether is successful or not. Also every method inside controller can be called with parameter input or with post input. If you omit the parameters when calling controller method than he will try to load that parameters from post and that is why i want to pass POST vars with php when calling controller for example i want to call: fopen("http://localhost/MyAppFolder/index.php/controller/method"); but i want to pass it some POST vars if that is possible Thanks. Code: [Select] <html> <head> <title>Testing</title> </head> <body> <?php $config = parse_ini_file("config.ini",1); $email = $config['Email']; $host = $config['Host']; print_r ($host); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $host); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $contents = curl_exec ($ch); $fp = fopen($host.'.txt','w+'); $fw = fwrite($fp, $contents); curl_close ($ch); fclose($fp); ?> </body> </html> Ok, I am having a problem here. I have an automation script I am trying to make, but I hit a road block. I need to open up multiple URL's from using an array of URL's stored in my config.ini file. It looks like this: Code: [Select] Config.ini Host[] = www.websitea.com Host[] = www.websiteb.com Host[] = www.websitec.com Host[] = www.websited.com I want to use curl_setopt to open up each one of the urls stored in $host. If I use... Code: [Select] print_r ($host); ...I get this output: Code: [Select] Array ( [0] => www.websitea.com [1] => www.websiteb.com [2] => www.websitec.com [3] => www.websited.com ) Now, I need to take those websites in the array and open each one of them using curl_unit. I tried doing this... Code: [Select] curl_setopt($ch, CURLOPT_URL, $host); Then Code: [Select] $fp = fopen($host.'.txt','w+'); But I knew that wouldnt work. Basically, I need to open up all of the pages listed in the .ini file and save the HTML Content of those pages to their own text file, that's named after the URL. I figured I could open an array of URLS from my INI and write each one to their own text file. Example: websitea.com.txt (HTML Content from www.websitea.com) websiteb.com.txt (HTML Content from www.websiteb.com) websitec.com.txt (HTML Content from www.websitec.com) websited.com.txt (HTML Content from www.websited.com) I have the following code:
$fp = fopen(“path_to_file”, ‘a’); flock($fp, LOCK_EX); fwrite($fp, $string); flock($fp, LOCK_UN); fclose($fp);If I try to lock the file in two different places at the same time, this will cause a race condition. How can I prevent this? I know in Java, for example, it has a concurrent library which contains reentrant lock, which basically tries to get the lock and if can't waits. What can I do in PHP? |