Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Blog advice

 
Luke Murphy
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I was thinking of starting blog and was looking for advice.

I was hoping to get one where it was easy to mark source code - such as it is in this very good web forum and also one that it was possible to embed javascript into my posts.

Any suggestions welcomed!

Thanks

 
Hauke Ingmar Schmidt
Rancher
Posts: 436
2
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using the syntax highlighter from Alexy Gorbatchev: http://alexgorbatchev.com/SyntaxHighlighter/.

Works in two modes: Either by "full" JavaScript where you can just paste the sourcecode into script tags or in a highlight mode where you have to do the HTML escaping (for < and the others). I use the first one, has the disadvantage that the source does not appear in the RSS feed. The script allows easy highlighting of selected lines.

You can integrate it easily where you are allowed to include external JavaScript.
 
Luke Murphy
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hauke Ingmar Schmidt wrote:I am using the syntax highlighter from Alexy Gorbatchev: http://alexgorbatchev.com/SyntaxHighlighter/.

Works in two modes: Either by "full" JavaScript where you can just paste the sourcecode into script tags or in a highlight mode where you have to do the HTML escaping (for < and the others). I use the first one, has the disadvantage that the source does not appear in the RSS feed. The script allows easy highlighting of selected lines.

You can integrate it easily where you are allowed to include external JavaScript.


Do you use free hosting with wordpress or bloggspot? And if so how do you integrate Alexy Gorbatchev stuff in with it?

Do you have a link to your blog?

Thanks.
 
Luke Murphy
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Muhammad Khojaye wrote:http://blogs.oracle.com/pranav/2008/12/blog_your_code_using_syntaxhig.html
http://neilblackburn.blogspot.com/2009/03/code-syntax-highlighter-for-blogger.html

hope this helps.


Hi! Thanks for this.

The problem is that most free blogs (wordpress, bloggspot) don't give tha ability to have your own folders where you can neatly store your javascript.

This will mean you end up with some remote calls to Alex's utilities.

does anyone know of some free blogging software where you can have your own folders?

Thanks

 
Hauke Ingmar Schmidt
Rancher
Posts: 436
2
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you want to store the Javascript locally?

With Blogspot/Blogger you can add a HTML/Javascript block to your layout and enter:


In your post you can then:


That's all you need to do.
 
Luke Murphy
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hauke Ingmar Schmidt wrote:Why do you want to store the Javascript locally?

With Blogspot/Blogger you can add a HTML/Javascript block to your layout and enter:


In your post you can then:


That's all you need to do.


I'm afaird my javascript / blog knowledge isn't that good, so you're going to have to be patient with me :-)

When you said "... add to your layout" or yuo saying have to add this to every single post or something that is in the template?

Many many thanks!
 
Hauke Ingmar Schmidt
Rancher
Posts: 436
2
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, it is a one-time thing. With Blogspot you (can) compose your page design by dragging boxes to slots (e.g. Header, Archive, Attribution, Blog posts...). These are rendered on every page. One type of box is simply HTML/Javascript where you can enter code at your own.
 
Luke Murphy
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hauke Ingmar Schmidt wrote:No, it is a one-time thing. With Blogspot you (can) compose your page design by dragging boxes to slots (e.g. Header, Archive, Attribution, Blog posts...). These are rendered on every page. One type of box is simply HTML/Javascript where you can enter code at your own.


That's good thanks. I'll try that so. You don't have any step by step guides?

Cheers
 
Hauke Ingmar Schmidt
Rancher
Posts: 436
2
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is not more to do than I already wrote.

When you created a blog at Blogspot/Blogger you can go to the "Design" tab, click on any "Add Gadget" link, select "HTML/Javascript" and paste the code from my first listing. That's it, now syntax highlighting is enabled.

In your blog post you then put your code in script tags like in the second listing. The code will be formatted.

If you run into any specific blockers, don't hesitate to ask.
 
Luke Murphy
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks to all.
 
Hauke Ingmar Schmidt
Rancher
Posts: 436
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, I am sorry, I forgot one important thing. You have to include the CSS for formatting. I put them to the code directly, that's why I missed them. Tab Design, Edit HTML. I included the following directly after the title tag.

 
Luke Murphy
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for this. I follow instructions, however, I am having difficulty adding Javascipt code which contains the <SCRIPT> tags.

I try...




I get:

Your HTML cannot be accepted: Closing tag has no matching opening tag: SCRIPT

Any ideas?

Note: My design template view, gives me two places to add the the HTML / Javascript gadget. I chose the top and put in the code you suggested?
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't nest SCRIPT tags. What are you trying to achieve by doing that?
 
Luke Murphy
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:You can't nest SCRIPT tags. What are you trying to achieve by doing that?


I wish to publish snippets of javascript similar to this blog...

http://www.bloggersentral.com/2010/03/where-to-host-javascript-for-blogspot.html

 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't see nested SCRIPT tags on that page ... ?
 
Luke Murphy
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:I don't see nested SCRIPT tags on that page ... ?


What I mean is he shows samples of Javascript



These samples begin and end with <script> tags

 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, but you can't nest them - meaning, you can't put one <script>...</script> inside of another one.
 
Luke Murphy
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:Yes, but you can't nest them - meaning, you can't put one <script>...</script> inside of another one.


Well I am obviously ot explaining this well :-(

I wish to Javascript code to be formatted.
To do this, I am included my javscript code within the blocks...



However the tesxt I wish to display and format begins and ends with the <script> tags.

Many thanks.
 
Hauke Ingmar Schmidt
Rancher
Posts: 436
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please read the documentation. It covers EXACTLY your problem: http://alexgorbatchev.com/SyntaxHighlighter/manual/installation.html

- You are missing two important lines from my example listing.
- Why are you using a Java brush for JavaScript?
- When highlighting JavaScript there exists this problem with this (the script) method. This is the only problematic case. You never mentioned JavaScript. But the other method works.
 
Luke Murphy
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hauke Ingmar Schmidt wrote:Please read the documentation. It covers EXACTLY your problem: http://alexgorbatchev.com/SyntaxHighlighter/manual/installation.html

- You are missing two important lines from my example listing.
- Why are you using a Java brush for JavaScript?
- When highlighting JavaScript there exists this problem with this (the script) method. This is the only problematic case. You never mentioned JavaScript. But the other method works.


Ok I get all that.

Thanks a million.

Much appreciated.
 
kritika das
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This has been very helpful thread, as even i was planing to create a blog of my own.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic