1 edb Aug 17, 2005 18:29
3 edb Aug 24, 2005 11:43
Sometimes there is a delay before the code gets converted after pasting stuff in the top box. Or maybe it just gets buggy - I dunno for sure. Simplest fix: put the cursor anywhere in the top box, add a space then delete it back out.
4 topanga Aug 24, 2005 14:15
I used it, and it works like a charm.
5 slamp Aug 25, 2005 17:02
I added a preview button to avoid this problem B)
<input type="button" name="preview" value="<?php echo T_('Preview') ?>" class="search" onclick="setTimeout('ProcCode();',10);" />
<input type="button" name="close" value="<?php echo T_('Add Code to Post') ?>" class="search" onclick="targetopener(document.form1.finished.value)" />
<input type="button" name="close" value="<?php echo T_('Close this window') ?>" class="search" onclick="window.close()" />
I will try to add PHP Syntax Highlighter.
6 topanga Aug 26, 2005 09:01
slamp wrote:
I will try to add PHP Syntax Highlighter.
That would be awesome !
7 personman Aug 31, 2005 01:22
There's a syntax highlighting plugin here:
http://forums.b2evolution.net/viewtopic.php?p=24874%22
8 slamp Aug 31, 2005 10:07
I saw it, in fact I wrote a renderer plugin only for php, then I saw the other solution so I stop working on it. Also I have the same problem as Mariono about html checkin.
9 jibberjab Sep 10, 2005 23:07
This doesn't seem to work for me in firefox... When I load the page in Windows XP using firefox 1.06 it shows two sets of code blocks instead of just one. In IE, the code displays fine... Can someone verify this on their end? The post in question is here:
http://blog.thedarksighed.com/travelblogue/2005/09/10/how_to_display_code_in_your_posts
jj.
10 edb Sep 11, 2005 01:14
Just a quick glance at your source code tells me you either did the hack incorrectly or have something *significantly* hosed in your blog somewhere. It's not a browser thing though. If it was the problem wouldn't show up in Firefox cuz that's the only browser I use - unless I'm testing skins.
your source code wrote:
<h2 class="topheading"><a href="http://blog.thedarksighed.com/travelblogue/2005/09/10/how_to_display_code_in_your_posts" title="Permanent link to full entry" class="permalink_left">How to display code in your posts</a></h2>
<div class="bText"><!-- ************************************ -->
<!-- EDITED TO REMOVE 'MORE' ICON -->
<!-- <p>In the admin/_edit_form.php locate the first javascript function, and paste the second function immediately below it:</p>
<p><code><br />
function launchupload()<br />
{<br />
window.open ("b2upload.php", "b2upload", "width=380,height=360,location=0,menubar=0,resizable=1,scrollbars=yes,status=1,toolbar=0");<br />
}<br />
<br />
function launchupcode()<br />
{<br />
window.open ("b2upcode.php", "b2upcode", "width=740,height=500,location=0,menubar=0,resizable=1,scrollbars=yes,status=1,toolbar=0");<br />
}</code></p>
<p>Next, scroll down and locate the UPLOAD section. Immediately below it, paste the UPCODE section shown below:</p>
<p><code> if( $current_User->check_perm( 'upload' ) )<br />
{ // ------------------------------- UPLOAD ---------------------------------- ?><br />
<input type="button" value="<?php echo T_('Upload a file/image') ?>"<br />
onclick="launchupload();" tabindex="12" /><br />
<?php<br />
}<br />
<br />and so on...
11 jibberjab Sep 11, 2005 01:34
Actually I think it's just that particular block of code which is causing the problem, because I've tested it with other random blocks of code which I copied from other posts, and they work just fine...
Basically what I was trying to do is copy the entire code with directions onto my blog in a post visible only to me (sort of a collection of useful hacks in one place without having to search for them on the forums).
So, I tried removing the section that goes into the b2upcode.php file and, if you check the post again, it posted just fine... It seems to me it's either the javascript section of the b2upcode.php code, or the fact that it contains the whole <html> top portion...
Check the post again.... it does work, just something about that particular block of code that doesn't allow it work...
http://blog.thedarksighed.com/travelblogue/2005/09/10/how_to_display_code_in_your_posts
jj.
12 edb Sep 11, 2005 03:06
Pasting from a phpbb forum to a blog app is hit or miss at best. Keep in mind all dynamic applications do their own funky things to make their bells ring and whistles sing. Just consider what b2evolution does with the "more" tag and you'll understand.
Why not just bookmark the pages you like, or keep a protected post with links to stuff you want to reference? It is a LOT more reliable than trying to paste an entire phpbb post into a blog app!
Bottom line is this: neither the hack nor the browser is causing the problem you are seeing. What you are seeing is how different browsers are trying to interpret a dynamically generated page that was copied from a different dynamic page generator.
13 cornetchap Sep 29, 2005 11:30
I implemented this hack into 0.9.1b so that I could add the following code:
<location /blog/wp-comments-newpost.php>
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^.*dvorak.org/.*
RewriteRule ^.* http://www.ctyme.com/comment-spam.html
</location>
But even with the hack I got an invalid tag error for the location tag.
14 slamp Sep 29, 2005 11:39
The code you quoted is not php source.
15 cornetchap Sep 29, 2005 12:05
slamp wrote:
The code you quoted is not php source.
I know, it's Apache configuration directives. So I can only use
<code></code>
for displaying PHP code?
<pre></pre>
didn't work either for the unencoded tags at least, I'll try modifying the hack to use
<pre>
then instead.
Thanks.
16 cornetchap Sep 29, 2005 12:09
cornetchap wrote:
I'll try modifying the hack to use
<pre>
then instead.
Which worked. To be honest I find that a little surprising as my understanding of using <pre> in this sort of context was that no interpretation was done on the text between the opening and closing tags.
Ho hum, at least it works :-/
17 slamp Sep 29, 2005 12:13
cornetchap wrote:
I know, it's Apache configuration directives. So I can only use
<code></code>
for displaying PHP code?
No, you can use the syntax highlighter plugin < http://forums.b2evolution.net/viewtopic.php?t=5258 > to display php code.
It uses ghesi < http://qbnz.com/highlighter/ > so you will be able to display a lot of different language, but i don't think apache conf directive
18 edb Sep 29, 2005 18:16
The gushey thing is cooler in a lot of ways, but I had no problem putting
<location /blog/wp-comments-newpost.php>
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^.*dvorak.org/.*
RewriteRule ^.* http://www.ctyme.com/comment-spam.html
</location>
in a post with this hack in my v12 installation.
19 cornetchap Sep 29, 2005 18:28
EdB wrote:
The gushey thing is cooler in a lot of ways, but I had no problem putting
<location /blog/wp-comments-newpost.php> RewriteEngine On RewriteCond %{HTTP_REFERER} !^.*dvorak.org/.* RewriteRule ^.* http://www.ctyme.com/comment-spam.html </location>
in a post with this hack in my v12 installation.
Neither did I once I'd changed <code> for <pre> ;) But I'm still confused as to why <pre> interprets the text between the opening and closing tags. Maybe I'm just easily confused.
20 edb Sep 29, 2005 18:58
Version-specific issue most likely? I haven't looked at upping this one to live inside dawn (91b) because I got way too much hackage to upgrade myself. First I need to upgrade, and hopefully before the next release happens, and then I'll keep an eye out for this problem and see if I can't make it work.
Oh plus I noticed it also made the url a link. That's a drag because it shouldn't have been - especially when the code you want to display is a domain you want to ban via .htaccess!!!
21 cornetchap Sep 29, 2005 21:09
EdB wrote:
Version-specific issue most likely? I haven't looked at upping this one to live inside dawn (91b) because I got way too much hackage to upgrade myself. First I need to upgrade, and hopefully before the next release happens, and then I'll keep an eye out for this problem and see if I can't make it work.
Maybe not, I took the trouble to lookup the meaning of <pre> and it seems it doesn't quite behave as I'd expected. It does seem to interpret embedded tags but it preserves whitespace and line breaks.
EdB wrote:
Oh plus I noticed it also made the url a link. That's a drag because it shouldn't have been - especially when the code you want to display is a domain you want to ban via .htaccess!!!
Almost, the URL is really a redirection for spam-bots that access the comment posting code directly rather than via the blog. So, if you substitute /blog/wp-comments-newpost.php with /blog/htsrv/comment_post.php you can also use these Apache directives to assist in preventing comment spam with b2evolution.
22 plack Nov 20, 2005 19:10
I have added the following format lines for tabs, double and single quotes. Turns out that the SQL cleaning syntax was converting these to left/right quotes of the double and single variety and it really messes up PHP.
fixing = fixing.replace(/ /g, " ");
fixing = fixing.replace(/"/g, """);
fixing = fixing.replace(/'/g, "'");
Everything is working well except I cannot get the "Add Code to Post" button to work. I end up with the post page displayed and nothing in the box.
I end up having to copy the text from the one box to the other. In all not bad, but I would like the post to work.
23 fede Aug 09, 2006 13:09
Hi Edb: I´m trying to modify your script so as to remove unwanted line breaks in the middle of paragraphs and remove those e-mail reply marks (> symbols). Just like Text Cleanup or similar programs does.
I added this code to your function ProcCode() {
fixing = fixing.replace(/<br>\s*<br>/g, '<!-- aaa -->');
fixing = fixing.replace(/<br>/g, ' ');
fixing = fixing.replace(/<!-- aaa -->/g, '<br><br>');
fixing = fixing.replace(/>>/g, ' ');
It works with the e-mail reply marks, but it doesn´t with the unwanted line breaks. Could you help me?
Hello,
When I'm using your hack, the code is not updated in the field above and in the post i'm writing I got: "Enter code in the field above and it will show up down here for a preview, then click "Add Code to Post", then close this window." instead of the code.
I'm using Firefox. Do you have an idea to resolve this ?