View Source Function
Moderator: General Moderators
View Source Function
I have a small scripts section on my site, and I show the source code for each script right out of the database onto the script page using the hightlight_string(); function.
The only thing that sucks is that some of the scripts push out my tables on my site and make it look real <span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span>. I have also tried the show_source(); function, and that does the exact same thing (obviously).
So I guess what I am asking is if there is anyway to make it so that when the source code is printed out, it does not override my tables and push them way out.
The only thing that sucks is that some of the scripts push out my tables on my site and make it look real <span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span>. I have also tried the show_source(); function, and that does the exact same thing (obviously).
So I guess what I am asking is if there is anyway to make it so that when the source code is printed out, it does not override my tables and push them way out.
I never use percents
I never use percents on my current design. So that can not be it.
Got any other ideas.

Got any other ideas.
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
found it!
in
in
on line 57 of the output you have a great big long mysql queryTitle: Edit MySQL Records
Category: Databases
Date: Saturday, April 6, 2002
But there are no spaces in it so it can't word wrap, so it forces the table to be to wide. If you put a space in yourself at the appropriate point it will wrap ok. It might have been easier to debug without all the font tags, a bit of CSS would save you a lot of coding.$result = mysql_query("UPDATE users SET name='$name',email='$email',phone='$phone' WHERE id=$id");
Still no help
No, none of your ideas have worked. The <pre></pre> thing just makes all the code print out without any wrapping, so its worse.
Any one else with an idea?
P.S. e+ I am not talking about the script code in my database. I am talking about when I go to print out that code, how do I make it so it will not push out my tables.
Any one else with an idea?
P.S. e+ I am not talking about the script code in my database. I am talking about when I go to print out that code, how do I make it so it will not push out my tables.
If you put spaces after the commas in your code it will work fine (or at least for the example I found). It's still perfectly acceptable code but it won't force the cell to be so wide. Because you have one VERY long string of letters the cell can't stay within the width you have told it to be so it's overiding your width command and making the cell as wide as the longest string of letters (the sql query). Once you put spaces in after your commas it will be able to wrap the text within the cell and not force it to resize. I know this works because I have done it to the source I captured from your page.
actually i believe the problem to be with the PHP functions. they convert all spaces to . Therefore all lines become incredibly long strings (with no spaces)... the only place for the function to wrap is at the end of the line. try looking at the source that either PHP function outputs...you should see what i'm talking about.
as far as a way around this? write a wrapper that converts the back to spaces? very inefficient and dirty, but it would work.
as far as a way around this? write a wrapper that converts the back to spaces? very inefficient and dirty, but it would work.
i'm assuming you mean adding spaces after the commas in his mysql call? that may work fine for that line, but what about any other long ones. i too have a 'viewsource' page on my site, and it simply will not break a block of text to wrap it. it will see the space between an HTML tag and it's attribute, but not with blocks of text... they are all converted to and won't budge.
<edit>
ok, well i found out why it's not working for me....not sure if it will apply to the issue that started this thread. i am echo()ing out rather large strings, and it is the text blocks in these that won't break. if you "?>" out of your PHP code, do your large blocks of pure HTML, and then "<?php" back in, it wraps
</edit>
<edit>
ok, well i found out why it's not working for me....not sure if it will apply to the issue that started this thread. i am echo()ing out rather large strings, and it is the text blocks in these that won't break. if you "?>" out of your PHP code, do your large blocks of pure HTML, and then "<?php" back in, it wraps
</edit>