janka Posted July 26, 2010 Report Share Posted July 26, 2010 Sveiki, Kādā veidā ir iespējams iekļaut failā kādu citu failu, kuram tiek norādīti mainīgie lielumi? Mēģināju darīt kā parasti — <?php include("index.php?id=menu"); ?>, taču tā nedarbojas. Kā lai citādi iekļauj index.php?id=menu? Paldies. Quote Link to comment Share on other sites More sharing options...
Klez Posted July 26, 2010 Report Share Posted July 26, 2010 <?php //ja tikai maniigo vajag , tad $id = 'menu'; //ja GET mainiigo, tad $_GET['id'] = 'menu'; include("index.php"); ?> Quote Link to comment Share on other sites More sharing options...
werd Posted July 26, 2010 Report Share Posted July 26, 2010 (edited) <?php /* This example assumes that www.example.com is configured to parse .php * files and not .txt files. Also, 'Works' here means that the variables * $foo and $bar are available within the included file. */ // Won't work; file.txt wasn't handled by www.example.com as PHP include 'http://www.example.com/file.txt?foo=1&bar=2'; // Won't work; looks for a file named 'file.php?foo=1&bar=2' on the // local filesystem. include 'file.php?foo=1&bar=2'; // Works. include 'http://www.example.com/file.php?foo=1&bar=2'; $foo = 1; $bar = 2; include 'file.txt'; // Works. include 'file.php'; // Works. ?> Edited July 26, 2010 by werd Quote Link to comment Share on other sites More sharing options...
Grey_Wolf Posted July 27, 2010 Report Share Posted July 27, 2010 werd -> kaada jega bija no tava Posta? Lai tikai buutu ? to ka nestraada to Topika autors jau pamanija, piedevam Klez jau iisi un ljoti kodoliigi deva atbildi. Quote Link to comment Share on other sites More sharing options...
janka Posted July 27, 2010 Author Report Share Posted July 27, 2010 <?php //ja tikai maniigo vajag , tad $id = 'menu'; //ja GET mainiigo, tad $_GET['id'] = 'menu'; include("index.php"); ?> Paldies, sapratu! Quote Link to comment Share on other sites More sharing options...
Леший Posted July 27, 2010 Report Share Posted July 27, 2010 Ieteicams tomēr darīt tā: $tmp = $_GET; $_GET = array('id'=>123); include(..); $_GET = $tmp; lai galvēnam failam arī varētu padot parametrus. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.