Recent Topics

1 Sep 25, 2004 05:16    

Hi Folks,

Using the threads here, I've managed to tweak my little heart out, adding and subtracting features to/from my skin. But I'm still stumped regarding one thing, so I'm hoping you'll help out this PHP newbie.

The long and short of it is this: I duplicated a skin used for a "main" blog, so I can better customize its twin for the companion "linkblog". In order to assign skinname2 to the linkblog, so far as I can tell, it needs to be under the skins directory. (It didn't appear in the admin's drop-down skin selection menu when I had moved it from under that skin tree.) No problem with that in itself, but here's the rub-- that twin skin shows up in the skin-switcher list, which I don't want. The same problem will probably pop up again, as I may do another duplication for a second main blog, with its own companion linkblog.

I think I should be targetting this code in _main.php:


 <li><?php echo T_('Choose skin') ?>:
    <ul>
   <?php //  --------- START OF SKIN LIST -------------- 
	 for( skin_list_start(); skin_list_next(); ) { ?>
	 <li><a href="<?php skin_change_url() ?>"><?php skin_list_iteminfo( 'name', 'htmlbody' ) ?></a></li>
    <?php } // - --------------- END OF SKIN LIST  ---------- ?>
   </ul>
 </li> 

I looked at some exclude-style coding in _class_blogstats.php, _class_itemlist.php, _recent.php and _functions_bposts.php files. Also hunted around the forum, esp. http://forums.b2evolution.net/viewtopic.php?t=842&highlight=exclude, but Isaac's reference to mysql in the code made me back off, in a hurry. I also googled php exclude -rewrite -apache, and stumbled across this snippet (modified):


// Skin Directories that should NOT be shown

$exclude = array ( "Twin4BlogB_LB",
   "Twin4BlogA_LB",
   );

$files = array();
 
if ( ! in_array($filename, $exclude)  ) {

$files[] = $filename;

}

Of course, after scratching my head raw, I still can't figure out how to incorporate this into the skin list code so I can test. BTW, since I'm trying to learn, please tell me-- in the last example, why do parentheses appear in the first $files line, but brackets in the last $files line?

Ugh! 8|

2 Sep 25, 2004 06:58

I've been poking around the files in the "Paris" release and noticed some comments in the skin selection function that tell it how to not show certain files. I do not know if these bits of code are active yet, or simply pieces that revs-yet-to-be will use, but you can give it a shot. You would have to upgrade to Paris (0.9.0.11) first, then try "_skinname".

Fair warning: I have no idea what will happen. All I know is that when I was looking at the skin changing functions in the Paris package to debug problems I was having (that turned out to be unrelated to the version) I noticed the part that will hide FrontPage files from the skin list. It MIGHT also make it so the skin doesn't work at all.

The only other way is to not have a folder in the skins folder show up in the list is to not have the list. Disable skin switching for your blogs.

3 Sep 25, 2004 07:05

The only other way is to not have a folder in the skins folder show up in the list is to not have the list. Disable skin switching for your blogs.

Awwww man, that's no fun! :o

Seriously, I appreciate the pointer, and will go check it out. If all else fails, I'll just go back and give the linkblog-skin-only a more obvious name, like Ignore_4LinkBlogOnly.

Thanks for the (speedy) reply! ;)

4 Sep 25, 2004 07:40

I should have thought a bit more... It's probable that this will also exclude it from the skins list in the back office. Makes sense right? If it's trying to hide folders that FP creates to do it's thing wouldn't it hide them from everywhere?

My project that got me in that area was a simple piece of code to make a "return to default skin". Skin selectors of the drop-down variety know which one is currently selected so I figured look there and see if I can also pick default. I could, but I couldn't make it turn that piece of information into a link. I think it's doable but I gave up on the project and just coded it for my exact type of url and access method.

So now I think about your initial thought on dealing with the skin selector in _main. The part where it says "for skin_function other_skin function" then does the "<li>make the skin name be a link to the skin</li>" is probably exactly where you want to be. It's in b2evocore and I think it's called _functions_skins (of all the crazy file names). I THINK you should be able to make a simple conditional statement that says "IF skinname != myspecialskin THEN do the list item thing". Problem is I got all jumbled up in there and got cross-eyed and side-ways and gave up.


Form is loading...