justinede Posted March 14, 2009 Share Posted March 14, 2009 Hello Freaks, I am looking for code that will act like an iframe and put content from one of my pages into another. Kind of what wordpress does, they have index and they call in the header and footer and comments. basically i have a website where i have last updated at the bottom and instead of going to all of my 10 pages and editing it over and over again, i want to have that info in just one file so i only have to edit it once. I could do this with an iframe, but i hate frames and i know you can do it in php so thanks in advance. Justin Quote Link to comment Share on other sites More sharing options...
Ayon Posted March 14, 2009 Share Posted March 14, 2009 try using <div> with "overflow:auto;" in the styles Quote Link to comment Share on other sites More sharing options...
justinede Posted March 14, 2009 Author Share Posted March 14, 2009 what? that dosnt make any sense what so ever for what i wanted. Quote Link to comment Share on other sites More sharing options...
Ayon Posted March 14, 2009 Share Posted March 14, 2009 my bad... missunderstood your question... maybe I get it right this time then you could make a file named "lastupdates.php" or w/e you want.. the just place <?php include("lastupdates.php"); ?> wherever you want it on your page... if i missunderstood again, ima give up Quote Link to comment Share on other sites More sharing options...
justinede Posted March 14, 2009 Author Share Posted March 14, 2009 hahaha no i think you got it right this time. xD let me try that h.o thanks Quote Link to comment Share on other sites More sharing options...
Ayon Posted March 14, 2009 Share Posted March 14, 2009 hehe no problemo .. havent slept for about 24 hours so it just took some time before my brain managed to process the question right xD EDIT: In my own defense.. You can put the include() inside a <div> tag with "overflow:auto;" xD haha Quote Link to comment Share on other sites More sharing options...
justinede Posted March 14, 2009 Author Share Posted March 14, 2009 hahah same here. lol ok so now I have to parts that are php included.. simple html and such.. what if i wanted to have like update.php and inside that, you would have two text boxes with the html from the two different included files. basically so i can change stuff in one page. Quote Link to comment Share on other sites More sharing options...
Ayon Posted March 14, 2009 Share Posted March 14, 2009 uhm... huh? Quote Link to comment Share on other sites More sharing options...
justinede Posted March 14, 2009 Author Share Posted March 14, 2009 haha ok alright let me explain. so suppose in my site, i have a recent news sidebar and a last updated div in my footer. i got both of them in separate php files using your include code (<?php include("new.php"); ?>). now instead of opening sidebar.php and updated.php to edit the content, i want to open up manage.php and be able to change the content in those to files from there. understand me know? xD Quote Link to comment Share on other sites More sharing options...
Ayon Posted March 14, 2009 Share Posted March 14, 2009 yeah now i get the question.. just ain't sure why u wanna do it like that xD maybe you could try making separate textareas in manage.php loading the info from new.php and lastupdate.php then you edit the content in the textareas and use fwrite or something? not sure, but that would be my first guess Quote Link to comment Share on other sites More sharing options...
justinede Posted March 14, 2009 Author Share Posted March 14, 2009 ya ya thats what i want. lol can you quickly write me a source code if you feel up to it. ? xD Quote Link to comment Share on other sites More sharing options...
Ayon Posted March 14, 2009 Share Posted March 14, 2009 ain't got the time php.net/fwrite ... currently fighting with a messed up css :S and it's winning atm Quote Link to comment Share on other sites More sharing options...
justinede Posted March 14, 2009 Author Share Posted March 14, 2009 haha alright well if you need any help, im a much more experienced html css guy than i am at php. xD Quote Link to comment Share on other sites More sharing options...
justinede Posted March 14, 2009 Author Share Posted March 14, 2009 yo so i got this bit of code somewhat working. But, it has the content already filled in with $somecontent = "add this..."; I want it to be what ever i type in the textarea that i named somecontent. Also, i want it to read out the current file in the textbox and edit from there. <?php $filename = 'test.txt'; $somecontent = "Add this to the file\n"; // Let's make sure the file exists and is writable first. if (is_writable($filename)) { // In our example we're opening $filename in append mode. // The file pointer is at the bottom of the file hence // that's where $somecontent will go when we fwrite() it. if (!$handle = fopen($filename, 'a')) { echo "Cannot open file ($filename)"; exit; } // Write $somecontent to our opened file. if (fwrite($handle, $somecontent) === FALSE) { echo "Cannot write to file ($filename)"; exit; } echo "Success, wrote ($somecontent) to file ($filename)"; fclose($handle); } else { echo "The file $filename is not writable"; } ?> Quote Link to comment Share on other sites More sharing options...
Ayon Posted March 14, 2009 Share Posted March 14, 2009 $somecontent = $_POST['textareaname']; Quote Link to comment Share on other sites More sharing options...
justinede Posted March 14, 2009 Author Share Posted March 14, 2009 ehh forget that.. lol looks to hard. cause then there is the thing about the special characters < >/ and all that stuff. lol thanks for the help though bud. add me on aim or gmail aim: netjamer01 gmail: justinsspit (@) g m a i l . [com] 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.