Recent Topics

output 'title=' info in "a href" for categories?

Started by on Mar 01, 2005 – Contents updated: Mar 01, 2005

Mar 01, 2005 02:30    

I'm working on integrating the "NiceTitles" javascript code to create mouseover effects for my links in b2evo. I'm using the stockholm skin which I've done some customizations with already. The NiceTitles code depends on there being

title="blah blah"

information in the hrefs. You can see how it works here: http://demo.1976design.com/nicetitles/

I've figured out how to get the script to work with the skins list already, but am having trouble getting it to show the information for the categories list. This is what I did to get the title text for the skins list (parts added by me are commmented):


<?php // ---------- START OF SKIN LIST ----------
for( skin_list_start(); skin_list_next(); ) { ?>
<li><a href="<?php skin_change_url() ?>" 

// THIS PART ADDED BY ME ------------
title="View with <?php skin_list_iteminfo() ?> skin"
// END OF NEW STUFF -----------

><?php skin_list_iteminfo( 'name', 'htmlbody' ) ?></a></li>
<?php } // ---------- END OF SKIN LIST ---------- ?>

However, I'm not sure which section of the _categories.php file to edit, to create the same kind of title= output to show each catgory name... (Same goes for the stuff in the archives, misc, and syndicate parts, but first things first.) Anyone interested in helping out, or working on it together? I think the effect the NiceTitle script creates are pretty nice. I'm new to php but am using this all as a learning experience. The category section is tricky though.. I keep getting parsing errors... :(

[edit: I've gotten the mouseovers to work via "title=" text for the referers, misc, and syndication sections now. Once I had the skins section to go by, those were relatively easy. Still can't figure out the categories section though, and the archives section looks like it might be difficult also. I'm looking at that one now.

Hopefully someone knows how to include title= info for the categories...? ]

jj.

Mar 01, 2005 03:33

I've gotten the code to work properly with the archives section now as well... I edited the _archives.php file in the /skins/ folder.... NOT in your particular skin's folder (i.e. /skins/_archives.php AND NOT /skins/stockholm/_archives.php)

I've commented the changes I added...


			case 'monthly':
// --------------------------------- MONTHLY ARCHIVES ---------------------------------------
echo '<a href="';
archive_link( $arc_year, $arc_month );

// NEXT LINE CONTAINS MY EDITS ---------
echo '" title="'.$month[zeroise($arc_month,2)],' ' ,$arc_year.'">';
// END EDITS ------------

echo T_($month[zeroise($arc_month,2)]),' ',$arc_year;
echo '</a> <span class="dimmed">('.$arc_count.')</span>';
				break;

Now, back to trying to get the categories to show title info...

jj.

Mar 01, 2005 03:53

I got it to work...!

I edited the /blog/skins/_categories.php file, not the one in the folder of your skin of choice... Below is the section I edited (Sorry, I'm not using an editor that gives me line numbers at the moment, but it's at around line 75 or so....


		echo '<a href="'.url_add_param( get_bloginfo('blogurl'), 'cat='.$cat_ID ). '" 

// START EDITS ------------
title="'.$cat['cat_name'].'">'.format_to_output($cat['cat_name'], 
// END EDITS --------------

'htmlbody').'</a> <span class="dimmed">('.$cat['cat_postcount'].')</span>';
		if( in_array( $cat_ID, $cat_array ) )
		{	// This category is in the current selection
			echo "*";
		}
		if( $cat_line_checkbox )
		{
			echo '</label>';
		}

And also the section approx 40 lines beneath it, to cover the "ALL" link:


	// Start global list:
	echo $cat_main_start;
	if( $blog > 1 )
	{	// We want to display cats for one blog
		echo "\n",$cat_group_start,"\n";

		if( !empty( $cat_all ) )
		{	// We want to display a link to all cats:
			echo $cat_line_start,"\n";

// START EDITS ----------
			echo '<a href="',get_bloginfo('blogurl'),'" title="View all Categories">',$cat_all,'</a>';
// END EDITS ----------

			echo $cat_line_end,"\n";
		}

Just have a few odds and ends left now with some random link types that aren't hooked up yet...

jj.

Mar 01, 2005 04:02

Has anyone else checked out the link in my first post to see what these mouseovers look like? I think they're pretty alright looking, but maybe nobody else does...
Anyway, I feel like I learned a little about php tonight by setting this up, and maybe someone else will like those link styles enough to want to install them and benefit from my learning experience. :)

jj.

Mar 01, 2005 09:16

Silly question - how do you change the background color of the mouseover popups?

Mar 01, 2005 11:25

When making changes to _categories.php, _archives.php etc, it's generally a bad idea to edit your files directly in /skins, since these files usually need to be upgraded when you upgrade b2evo. It's best to copy the entire contents of these files into skins/yourskinname/ and edit the files from that directory. That way your mods are more likely to survive the upgrade procedure.

To edit the colours, just edit the css you added for the mouseovers.

Mar 02, 2005 00:19

hmm... where were you when I was just starting? :)
Well, the changes I made were not too extensive, so I can definitely change them back...

Something I'm not entirely clear on... If the main /blog/skins/ folder has a copy of the _archives.php and _categories.php files, and the individual skin folder has one also, does the copy in the individual skin folder override the one in /blog/skins/ ? In other words, is it okay to have both copies active?

jj.

Mar 02, 2005 00:38

Look at the files as they stand at the moment in your individual skin's directory. All it does is call the file in the main skins directory. When you have your own version in there, there is no call to that file, so it isn't read.

Mar 02, 2005 16:49

I'm using the nicetitles javascript and am looking for a way when I hover over an image link for it not to trigger since I am using stk's CSS caption Zoom and the nicetitles interferes/obscures my captions.

Mar 02, 2005 17:42

This is completely off topic. You should have made a new topic. Anyway, this isn't possible. You could fiddle with the css, but I still don't think it will work. You'll have to choose one or the other.


Form is loading...

Build your own site! – This forum is powered by b2evolution CMS, a complete engine for your website.