1 s0me0ne Feb 05, 2006 06:05
3 s0me0ne Feb 05, 2006 17:31
Actually just using
<h3 class="bTitle"><a href="<?php $Item->permalink() ?>" title="<?php echo 'Permanent link: ' . $Item->title; ?>"><?php $Item->title(); ?></a></h3>
worked B) nice info about the title vs title() bit ;)
Now what if I wanted the URL to link option, how would I get about getting that to work?
4 yabba Feb 05, 2006 18:13
5 stk Feb 05, 2006 21:18
s0me0ne,
Have a go with the following, as I think it will get you where you want (tested in Dawn).
<h3 class="bTitle">
<?php
if ( $Item->url ) {
$Item->title();
} else {
echo '<a href="'.$Item->permalink.'" title="Permanent Link: '.$Item->title.'">'.$Item->title.'</a>';
}
?> </h3>
6 cslepage Aug 19, 2006 20:53
stk, when I put that code in my stockholm remix main.php, it linked each title to http://myurl.com/stockholmremix/.
7 stk Aug 19, 2006 21:58
cslepage,
First, when you say - "that code" - to which code are you referring, as there are a few on the page?
At first, I thought it might be a b2evolution version problem (you didn't specify WHICH version of b2evo you're using). So, I cut-'n-pasted the following php code (assuming the last posted is what you tried) into my v1.8 install. It created a title, linked to permalink, that had a bubble-text hover that said "Permanent Link: [Title of the Post]".
Seems to work for me?
If you post a link to your site and paste the code your using/trying, that might help narrow it down too.
<?php
if ( $Item->url ) {
$Item->title();
} else {
echo '<a href="'.$Item->permalink.'" title="Permanent Link: '.$Item->title.'">'.$Item->title.'</a>';
}
?>
8 cslepage Aug 19, 2006 22:05
Sorry, yes, it was your previous code that I tried to use.
When I use your most recent code to substitute for
<h3 class="bTitle"><?php $Item->title(); ?></h3>
It links each title to
http://www.comiclist.com/skins/Stockholm_remix/
9 edb Aug 19, 2006 22:18
<h3 class="bTitle"><?php
if( $Item->get('url') ) {
$Item->permanent_link( '#icon#' );
$Item->title();
} else { ?>
<a href="<?php $Item->permanent_url() ?>" title="<?php echo T_('Permanent link to full entry') ?>"><?php $Item->title( '', '', false ); ?></a>
<?php } ?>
</h3>
In 1.8.0 and 1.8.1 that'll give you a title that EITHER links to the permalink OR includes a permalink icon and the title linked to whatever you put in your URL field when you post.
I gotta tell ya: it really helps us help you if you give us a link to your blog instead of making us figure it out. Those of us who answer frequently tend to know how to poke around a bit, and therefore can figure out stuff we wouldn't have known to ask about.
10 cslepage Aug 19, 2006 22:34
EdB wrote:
I gotta tell ya: it really helps us help you if you give us a link to your blog instead of making us figure it out. Those of us who answer frequently tend to know how to poke around a bit, and therefore can figure out stuff we wouldn't have known to ask about.
I'll keep that in mind when I ask questions in the future.
11 stk Aug 19, 2006 22:38
Here's another bit of code to try:
Don't know why the above code isn't working for you, as I'm also running v1.8 and it worked fine for me.
However, your permalinks seem to be correctly linked, so you could use this modified version, instead (just swaps out the HREF bit above, for the permalink version that's already used for your permalinks).
<?php
if ( $Item->url ) {
$Item->title();
} else { ?>
<a href="<?php $Item->permanent_url() ?>" title="Permanent Link: <?php echo $Item->title ?> ">
<?php echo $Item->title?>
</a>
<?php } ?>
You might want to check the first bit (if you've linked the title to a URL when you posted it) ... as I haven't tested that part.
But the last bit should get you what you want, for sure. (Or Ed's).
:D
Yes, it helps when you say version, put a link and any code!! ;)
PS - Couldn't connect to your root domain using IE. Don't know if it's me/you/internet, but thought you might like to know.
12 cslepage Aug 19, 2006 22:53
stk wrote:
PS - Couldn't connect to your root domain using IE. Don't know if it's me/you/internet, but thought you might like to know.
That's my next question. My blog, comiclist.com, was coming up in IE fine until today, when I started making adjustments to main.php for the stockholm remix theme. Other themes are still working in IE. As noted above, I'm using 1.8.
My other blog, http://smileysmile.net/desperblog/index.php, also 1.8, is also not working in IE.
EDIT: It appeared to be this javascript:
<script type='text/javascript'><!--
var ontok_highlighter = {linkids:{ontok:"e4c1ada7",google:"pub-7509141076539903",ad_channel:"5976960028",amazon:"comiclthenewc-20"},selectivity:1,maxhighlights:12,linkcolor:"0000FF",
shell:{bordercolor:"089df9",tabbgcolor:"ffd938",tabbgcolor2:"0764b4"},search:{bordercolor:"FFFFFF",bgcolor:"FFFFFF",
linkcolor:"0000FF",textcolor:"000000",urlcolor:"008000"},ad:{bordercolor:"FFFFFF",bgcolor:"FFFFFF",linkcolor:"0000FF",textcolor:"000000",urlcolor:"008000"}};
//--></script>
<script type="text/javascript" src="http://search.ontok.com/hl.js"></script>
Just above "head" it worked in Firefox but apparently choked IE.
We don't have a link blog, so I can't test it. Try the following and see if it does what you want:
The "solution" is using $Item->title (which only spits out text) as opposed to $Item->title() (which yields the whole <a href> thing.
The string replace just future-proofs you (in case you use a double-quote in a title). ;)
If this doesn't do it, I need some more info.
Keep in mind though, that using this setup means that you can't link your title to anything other than the permalink. You'll need additional logic, if you ever want to use the "Link to URL" option.