Hi,
For my Database-Driven Websites project I have had to make a dynamic website. One of the requirements is I need a hyperlink to display the code used on each page.
Is there a method to do this requiring as little coding as possible?
Thanks
Displaying all code dymanically
Page 1 of 19 Replies - 292 Views - Last Post: 12 December 2012 - 03:14 PM
Replies To: Displaying all code dymanically
#2
Re: Displaying all code dymanically
Posted 12 December 2012 - 09:50 AM
With as little code as possible, you could use <code></code> tags.
#3
Re: Displaying all code dymanically
Posted 12 December 2012 - 09:54 AM
This doesn't work with PHP. Anything else?
#4
Re: Displaying all code dymanically
Posted 12 December 2012 - 09:56 AM
Well, what have you tried so far?
#5
Re: Displaying all code dymanically
Posted 12 December 2012 - 09:59 AM
I was going to use a jQuery popup.
Perhaps if I go through the PHP and change the "<?php ?>"
to <?php ?> and place it within the code tags and then place it within the div.
Perhaps if I go through the PHP and change the "<?php ?>"
to <?php ?> and place it within the code tags and then place it within the div.
#6
Re: Displaying all code dymanically
Posted 12 December 2012 - 10:03 AM
Give it a shot. If it doesn't work, we'll still be here.
#7
Re: Displaying all code dymanically
Posted 12 December 2012 - 10:08 AM
Jezzabeanz, on 12 December 2012 - 11:48 AM, said:
Is there a method to do this requiring as little coding as possible?
You shouldn't be thinking in this mindset. Code to get it done, not to get it done as easily as possible.
You need to get over the idea of technologies being judged by difficulty. It takes what it takes to get done. If you want simple, stick to working in wordpress (or another wysiwig) & don't take on coding projects.
#8
Re: Displaying all code dymanically
Posted 12 December 2012 - 10:40 AM
Jezzabeanz, on 12 December 2012 - 12:59 PM, said:
I was going to use a jQuery popup.
Perhaps if I go through the PHP and change the "<?php ?>"
to <?php ?> and place it within the code tags and then place it within the div.
Perhaps if I go through the PHP and change the "<?php ?>"
to <?php ?> and place it within the code tags and then place it within the div.
I prefer using pre. showcode.php:
<?php $filename = "showcode.php"; $data = htmlentities(file_get_contents($filename)); echo "<pre>".$data."</pre>"; echo "<br><br>"; echo "<code>".$data."</code>"; ?>
This post has been edited by CTphpnwb: 12 December 2012 - 10:41 AM
#10
Re: Displaying all code dymanically
Posted 12 December 2012 - 03:14 PM
You can use file_get_contents (like in CTphpnwb's example) to retrieve the actual PHP source of a file without having it execute first.
Also that highlight_file is amazing, I've didn't know that existed until now and it's pretty awesome.
It'd be a big security hole, but you can create a single script using either of the above examples and then use a GET variable for the file. For more security you can limit what directories the user can view.
With something like that you can do your jquery popup. It would have to fetch that page though, your task would be impossible using javascript alone.
Also that highlight_file is amazing, I've didn't know that existed until now and it's pretty awesome.
It'd be a big security hole, but you can create a single script using either of the above examples and then use a GET variable for the file. For more security you can limit what directories the user can view.
With something like that you can do your jquery popup. It would have to fetch that page though, your task would be impossible using javascript alone.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote











|