Jump to content

Specific Coding Q: $output Function


David_the Real
 Share

Recommended Posts

Why: I am posting this Q here because w3schools is the site I am always using for good reasons for my HTML and CSS needs - it's the best around! Now, this is a php Q and there are more specific php forums on the web, but I would prefer to stick with w3schools if permitted. So here it goes:What: In a wordpress plugin called twitter tools from Alex King is this line of code:

$output .= '		<li class="aktt_more_updates"><a href="'.aktt_profile_url($aktt->twitter_username).'">'.__('More updates...', 'twitter-tools').'</a></li>'."\n";

I have a general Q on this as I come across similar instances elsewhere. How do I get the "target="_blank"" in there? I tried to put it in various places where it *should* be, but it gives either fatal error, like in this place:

$output .= '		<li class="aktt_more_updates"><a href="'.aktt_profile_url($aktt->twitter_username).' target="_blank"">'.__('More updates...', 'twitter-tools').'</a></li>'."\n";

or does nothing.You realise, yes, I am not a php coder. In my days, back in the 70s and 80s we used assembler and pascal, later I learnt html, but never had time to learn another! language...Does anyone have a solution?Thanks for reading anyway.Cheers David

Link to comment
Share on other sites

You just have an errant double quotation mark in your modified code - can you see it?
No, I have not, I can see every stroke. The first double quote belongs to the target="_blank" I added. The next double quote was there before, in the original code. Can you see it? I know it's hard to see, I tried to highlight with BB code but wasn't able to, probably because it's within a code section itself.
Link to comment
Share on other sites

I don't see any doubling of a double quote in the original code... but in your addition, you have:

' target="_blank"">'

It should be

'" target="_blank">'

Link to comment
Share on other sites

I don't see any doubling of a double quote in the original code... but in your addition, you have:
' target="_blank"">'

No, I have not. It seems to be difficult to see in the code box, hence now I post it without, but highlighted below:Look, this is the original bit, taken from my initial post:twitter_username).'"> #See the double quote already there?This is what I want to add:target="_blank" #See the double quote that belongs to the _blank?Consequently, this is the sum of both: red was original, blue is my addition:twitter_username).' target="_blank"">Hope this helps to see it.CheersDavid

Link to comment
Share on other sites

I meant that it's normal (in fact required) that there be a double quote once at that point. But it's not normal (in fact invalid) to have two double quotes one after the other.Your addition looks like:twitter_username).' target="_blank"">but it should betwitter_username).'" target="_blank">

Link to comment
Share on other sites

I meant that it's normal (in fact required) that there be a double quote once at that point. But it's not normal (in fact invalid) to have two double quotes one after the other.Your addition looks like:twitter_username).' target="_blank"">but it should betwitter_username).'" target="_blank">
I see what you mean. I should have added my code after the original ", not before! I had tried 3 variations but apparently not that one. Now I did as you said and voila! it works! :)Thank you so much!Was a stupid Q I admit - sometimes I just can't see the wood for the trees... :)If I can return the favour and do some coding for you? ... No I can't, I admit! :)
Link to comment
Share on other sites

Don't worry, debugging is often the hardest part of the development process. A useful thing to do is to take your generated source and run it through the HTML validator - it will tell you if you have an HTML errors, and exactly where they are.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...