How To Display Php Code [resolved] - Html Help With Php Codebox

free web hosting
Open Discussion > CONTRIBUTE > Computers > Programming Languages > HTML, XML etc..

How To Display Php Code [resolved] - Html Help With Php Codebox

matak
I'm trying to make codebox for my guestbook so that users can post PHP code inside..
I tried many versions but none of them works

If i use <xpm>, <pre> or <textbox> i can display HTML code, but when i try to write PHP code it executes it does not display..
There is a way to make swap for <? with ANSCI characters but that is not convenient for me.

You have codebox in forum to display php how can i make that?!
thanks

Reply

truefusion
Use the PHP function "htmlentities" to convert everything placed inside the CODEBOX bbcode. That should do it.

Reply

jlhaslip
What happens if you use the <pre> tags but do not include the php start and end tags?
CODE
<pre>
<!-- -some php code here -->

echo 'this';
echo 'and that ';

<!-- -end php code here -->
</pre>

Reply

matak
I found this way..

CODE
<?php

$mycode = '<?php echo("hello");?> <html>';

$stvarno = array ("<", ">");

$zamjenjeno = array ("&lt;","&gt;");

$code = str_replace($stvarno, $zamjenjeno, $mycode);

echo ("$code");

?>


now i need to find a way that my guestbook creates this $mycode string.. that's bothering me to, but i really didn't start on creating gbook yet. i hopet that's not gonna be problem..

@jlhaslip
in your code you dont use php start and end tags, when you use them it just echo's this and that

@truefusion
i don't know that command, and that, i'll probably use that later maybe for adding bbcode. if you can make simple example of how to use it it would be great..

Reply

matak
i wanted to change topic to solved, couse this is really what i was looking for a long time. i guess i was lucky 10 minutes after posting, so if mods can change title to something like "How to display php code" it would be great. I tried editing but i guess it's not an option in new forum anymore...

Reply

serverph
QUOTE(matak)
i wanted to change topic to solved, couse this is really what i was looking for a long time. i guess i was lucky 10 minutes after posting, so if mods can change title to something like "How to display php code" it would be great. I tried editing but i guess it's not an option in new forum anymore...


topic title modified as per thread author's request. smile.gif

Reply

matak
QUOTE(serverph @ Jan 31 2007, 08:13 PM) *
topic title modified as per thread author's request. smile.gif

thank you dear moderator biggrin.gif
i just wanted to add this little perk of code above..

if you want to add some html features to your codebox like bold do it like this..

CODE
<?php

$mycode = '<?php echo("hello");?> [b]<html>[/b]';

$stvarno = array ("<", ">", "[b]", "[/b]");

$zamjenjeno = array ("&lt;","&gt;", "<b>", "</b>");

$code = str_replace($stvarno, $zamjenjeno, $mycode);

echo ("$code");

?>


and voila, you can say that is BB(bulletin board) code
but for some reason it's not going to bold < and > characters.. dunno why

 

 

 


Reply

truefusion
I know the problem is resolved, but i'll respond to these...

QUOTE(matak @ Jan 31 2007, 01:51 PM) *
@truefusion
i don't know that command, and that, i'll probably use that later maybe for adding bbcode. if you can make simple example of how to use it it would be great..

CODE
<?php

$mycode = '<?php echo("hello");?> <html>';
$mycode = htmlentities($mycode);

echo "<pre>".$mycode."</pre>";

?>

This is how i would have done it: less work, just as affective.

QUOTE(matak @ Jan 31 2007, 02:48 PM) *
but for some reason it's not going to bold < and > characters.. dunno why

Reason being 'cause the bbcodes don't surround the less-than and greater-than symbols, like so:
CODE
$mycode = '[b]<[/b]?php echo("hello");?[b]>[/b] [b]<html>[/b]';

Reply

matak
thanks for the tip.. Really is much simpler.
I solved that issue with bolding < and > characters. It was kinda simple, all i had to do is add <pre> tag to echo.. like you did with htmlentities code it works just fine...

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.

Recent Queries:-
  1. display html on php page - 1.26 hr back. (1)
  2. php display html - 13.75 hr back. (1)
  3. display the code of links in php - 22.83 hr back. (1)
  4. inbox code php - 24.96 hr back. (1)
  5. php display html code - 38.11 hr back. (1)
  6. displaying php dynamically on a html page - 42.23 hr back. (1)
  7. display html code with php - 45.56 hr back. (1)
  8. how to display "php code" in a html page - 57.54 hr back. (1)
  9. display video in php with code - 67.33 hr back. (1)
  10. display html php - 74.11 hr back. (1)
  11. display php in html - 83.20 hr back. (1)
  12. php display code - 89.75 hr back. (1)
  13. how to display php code on a html page - 92.10 hr back. (1)
  14. display php page html - 96.44 hr back. (1)
Similar Topics

Keywords : display, php, code, resolved, html, php, codebox

  1. Some Questions On Html
    (6)
  2. Help Making A Web Adress Bar Using Html/js
    (9)
    Hey I need to make an adress bar basically you imput into the field press enter and your away but it
    cant use php or any code that needs to be installed, its all part of a workaround for my school
    interenet!....
  3. Html Ascii Codes - A Complete List
    downloadable php file (3)
    I was often frustrated at how, despite there being thousands of ASCII "special characters" such as
    &8659; , websites that claimed to list them all only listed the first 256. To combat this issue,
    I have created a table which lists the first 10,001 - from &#000; to &10000; I am sure
    there are many more but it is simply not feasible to create a table with many more rows as viewing
    it would put terrific strain on the browser.! You can download the file in two forms. One uses
    PHP to dynamically create the table (1KB), the other has it ready-made in pure HT....
  4. Html Div Help [resolved]
    help with the divs in ipb (1)
    hey guys, as you may know, i have ipb 2.3.4 set up on my site. i am currently using the centura
    skin and like it a lot. i have customised the header bar in terms of the logo, however also want a
    slab of text linking to the forums home at the top of the banner. i have so far managed to achieve
    this to work in firefox (see attached screenshot), however it just screws up in ie, opera and safari
    (i think). the link is here here is the code, both html and css, of the ipb header, and i have
    placed between stars the parts i have edited: CODE the css (only the ed....
  5. Applet Code
    (0)
    Hi There! ....
  6. Best Way To Protect Html Form Fields
    Looking for suggestions on how to protect form fields during user inpu (3)
    My working example is here http://sonesay.trap17.com/application.php The form submits to itself
    and stores what ever the user inputs into session variables. Thats all fine and I have validation
    checks for it, I wanted to add more and I remember comming across a site where they would lock from
    fields to prevent any changes if the information was already supplied and validated. I'm looking
    to build something similar but cant seem to figure out how to get that same effect at this time.
    Heres my program logic so far application.php includes('application_content.....
  7. Html Application Form
    (6)
    does anyone know how to make a form/application that when you submit the form with the submit but it
    sends it in a email to you email address if anyone on here knows please please let me know thanks, i
    want this so i can have members apply for a team on my football site and there information will come
    back to me and i can accept or reject them for that job....
  8. I Need Help With This Code
    (3)
    could some one help with this code. I have been working on this for the past hour trying to get it
    to work. this is the first time i have had problem with writing html code. the code i need help
    with is HTML a href =" http://www.darkzone3.110mb.com/contact.php " target=" _blank ">
    input type =" image " height=" 27 " width=" 139 " src="
    http://www.darkzone3.110mb.com/buttons/contact.png " /> /a > for some reason on my page it
    want work at all it want even open it the same page. What i'm trying to do with the code is a
    page in a new window using an....
  9. Email Form Code
    (8)
    I want to create my own e-mail form for my site and I don't quite know if JavaScript or PHP is
    required. I use my Nintendo Wii to manage my sites so I only can use what my webhost allows. I am
    using Angelfire for my main site and InvisionPlus for my forums. I'm planning on switching to
    Trap17 for my main site. Well here is my current code. Please tell me what I need to change.
    Message ....
  10. Login In Using Html
    (12)
    I have looked around and I can't find any code to help me out. I want to make it so you can log
    in to my site to get member featues. Could some one please help me....
  11. Wanna Learn Html From Scratch
    downloade an online tutorial,formatted my c: lost it forever,and FORGO (5)
    id prefer something i can download .....coz my internet connection is highly intermittant Moved
    from the Java section to the HTML section. ....
  12. Help With Css/html Layout
    Horizontal List Problems (5)
    I can't figure out why this horizontal list isnt working. Underneath my banner is supposed to
    be a green gradient bar with a list of links in the center of the page. The links are all the way
    to the left and are really small. The banner is also overlapping the list for some reason. This is
    my current layout(don't worry, I'm not trying to advertise).
    http://www.stormgaming.net/stormcreations/ This is my CSS file
    http://www.stormgaming.net/stormcreations/storm.css Thanks in advance for any help.....
  13. Html Help
    (6)
    ok so i need help again i was wondering how i can make a navigation bar that looks like this
    Free Website Templates <!-- Start of Page Menu -->
    Information Slide Show Pictures title="Time Line"> Time
    Line <!-- End of Page Menu --> Im having a problem putting
    the names of things that i want to go in those four boxes i tried to put in names but it didnt show
    up so i was wondering if anyone could give me some help....
  14. Some More Help With Html
    (2)
    Ok so yet again i need some help i have this so far: CODE <html> <head>
    </head> <BODY BGCOLOR="black" TEXT="white" LINK=#XXXXXX
    VLINK=#XXXXXX> <body> <center><h1> Pearl
    Harbor</h1></center> <hr> <p> <a
    href="http://photobucket.com" target="_blank"><img
    src="http://i173.photobucket.com/albums/w59/tuhyd/pearlharbor.jpg" border="0"
    align=right alt="USS Arizona "></a></right> <a ....
  15. Ok Background Help Please
    html (4)
    OK so i've given up on the paint for background now how would i get it to look like this
    http://img.photobucket.com/albums/v614/Dj1.../background.jpg without using paint and without it
    coming out to look like this... http://img.photobucket.com/albums/v614/Dj169211/Damn.jpg like,
    with just html code, not trying to use paint and do the BS any ideas?....
  16. Help With Html
    (11)
    Ok so i just started learn html about a couple of weeks ago and i make a background image using this
    code: CODE <style type="text/css"> body {
    background-image:url("http://img.photobucket.com/albums/w59/tuhyd/backgrounds.jpg
    4;); background-repeat: no-repeat}</style> and i am having trouble putting my
    text on the top in the center becasue my links are on the left every time i try and move the text up
    it moves the links down and separates them and i don't know what to do. added code tags.
    please use appropri....
  17. Transparent Roll Over Pictures
    Whats the code for tranparent pictures (4)
    I dont want just transparent pictures i want a sort of rollover image. I see this done on myspace a
    lot. A transparent picture that when you roll over is less transparent. I want that for my site. Go
    to: http://boozkerstweaks.trap17.com/tutorials...ws_to_vista.php And look at the thumbnail at
    the beginning. I want that to be a transparent image that when you roll over it, it becomes less
    transparent. Ive seen this in HTML and CSS. Either way is fine with me. I looked on this site and
    google, but never really found what i wanted. Almost everyone was only how to make ....
  18. My Very Sad Code
    (4)
    So i usually work in notepad, or frontpage but i was using dreamweaver instead because i wanted to
    see the difference and i like it better than frontpage and all. But as usual i cant get anything to
    work. I wanted the table to be over the images i took the table out .
    http://www.indiealways.trap17.com/zooey.html is the link to the page HTML html xmlns ="
    http://www.w3.org/1999/xhtml "> head > meta http-equiv =" Content-Type " content=" text/html;
    charset=iso-8859-1 " /> title >Untitled Document /title > /head > body > style type =" text/css
    "> body....
  19. Having Html Troubles......
    Please help! (1)
    I'm having troubles with the background colours on the HTML pages on my site
    keri-j.trap17.com Basically, the colors are hex codes and i'm no HTML n00b, god no! But, I
    just can't figure this one out! I have the background colour in the body tag (duh) " " on
    all my pages but on some of them the background is white. This might be to do with some javascript i
    have recently edited in each page or certain errors but whatever it is i can't figure it
    out! This is my homepage with the correct background color This is my poetry page with the
    fau....
  20. Wanting To Touch Up/learn My Html Again
    (27)
    Ok, well recently i realized that i am not as skilled in HTML (such as building website layouts) as
    i want to be, with tables etc... and so i was thinking about going through many many many many many
    many sites and just touching up on my HTML and see if i can code my own website template before
    starting to learn PHP because that is what i want to do. so, i am asking all of you experianced
    people on trap17 what websites did you use to learn your HTML skills, yees i know i could go to
    google and type in learn html or somthing along the lines of that, but i want to know wh....
  21. Creating Rss Feeds For Wapsites
    How to display rss feeds in a php enabled site (5)
    Anyone who wants to help me? I want my site to have this feature but I don't know how.
    /sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> Hope you could me
    with embedding these xml files in my wml pages.. Moved to the HTML, XML ect.. forum ....
  22. Creating Link In Html - Help Me With This!
    (5)
    edit: Neeeaavverrrminddd..... I was a total noob at php when i posted this and I needed help doing
    something with bbcode in php and didn't really know what I was saying.. /blush.gif"
    style="vertical-align:middle" emoid=":blush:" border="0" alt="blush.gif" /> Anyway topic
    resolved.......
  23. Html Question Concerning Pre Tag And Code Tag
    (8)
    My question is, why would anyone use the CODE tag when you can use the PRE tag? 1. The PRE tag
    recognises white space, the CODE tag does not. 2. The CODE tag requires that you escape some
    chars, the PRE tag does not. I cannot see anything that the CODE tag achieves that is special apart
    from sounding as though it is perfect for displaying code which IMO it is not. Thanks. ....
  24. Html And Javascript
    Not php as first indicated... (12)
    Edit your ScrollBar colors Change "Your color", to color code, that u need. CODE <STYLE
    type="text/css"> <!-- BODY { scrollbar-face-color: Your color;
    scrollbar-highlight-color: Your color; scrollbar-3dlight-color: Your color;
    scrollbar-darkshadow-color: Your color; scrollbar-shadow-color: Your color;
    scrollbar-arrow-color: Your color; scrollbar-track-color: Your color; } -->
    </STYLE> Insert Date Place this code between , tags CODE <script
    language=Javascript> <!-- v....
  25. Do You Know Html?
    Just Wondering, most of you would know. (65)
    Well I was just wondering, i know this polol might sound stupid, as this is a hosting site forum and
    the chances are you do know HTML, but the other day i met 2 people who didt have a clue what HTML
    was, and was just at the forum because they found this forum active. And also do you know any other
    programming languages, just wondering. I myself know HTML, C++ kinda, and learing PHP. Talking about
    Languages I know Tamil, English, Lote /tongue.gif' border='0' style='vertical-align:middle'
    alt='tongue.gif' /> .....
  26. Html Editor
    non WYSIWYG (19)
    What editor can I download and use that isn't a WYSIWYG(what-you-see-is-what-you-get) and is
    free. Currently I use NotePad but I want something better.....
  27. Html Cool Codes?
    (6)
    hey guys..whats up..well i ws just wondering if you guys have any cool codes for myspace or
    something..you know to design a page using html/css codes...see i tried googling around but all the
    sites had the same thing..they dont have a unique one...i want like games in my page...like my
    friend he had like tetris in his page..and i want a game// or anything like that to make my page
    cool /smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' />
    anybody????plz...PEAcE!....
  28. Redirect Code Help
    (8)
    Can someone give me the code which redirects you automatically in the whole page instead of only in
    the frame? I'm using this code, but it just redirects inside a frame... CODE <meta
    HTTP-EQUIV="REFRESH" content="0; url=http://www.something.com"> But now
    .tk has added a ad to the pages so I don't want to use it anymore, so I want that people
    entering the site is being redirected to the "real" domain name now.......
  29. Whats The Best Code?
    www.bpsite.tk (32)
    Whats you fav code?....
  30. where did you learn html from?
    (89)
    HI, i am intresting in knowing where you began learning html of what inspired you to start learning
    html. which programs did you use or which progs dyu use?....

    1. Looking for display, php, code, resolved, html, php, codebox

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for display, php, code, resolved, html, php, codebox

*MORE FROM TRAP17.COM*
advertisement



How To Display Php Code [resolved] - Html Help With Php Codebox



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE