Not signed in ( Sign In)

Categories

Welcome, Guest

Want to take part in these discussions? Sign in if you have an account, or apply for one below

Vanilla 1.1.10 is a product of Lussumo. More Information: Documentation, Community Support.

    •  
      CommentAuthorpulguita
    • CommentTimeAug 9th 2009 edited
     permalink
    Hola

    Me gustaría poner esto en mi blog de flatpress:

    http://forums.techarena.in/software-development/1104587.htm

    pero no encuentro cual es el html o php que debo cambiar o si seria posible hacerlo.

    P.D: El español se parece mucho al italiano. :)
    •  
      CommentAuthorlaborix
    • CommentTimeAug 9th 2009
     permalink
    I'm not sure, if this is possible in Flatpress, but take a look here:
    ...individual footer and title
    •  
      CommentAuthorpulguita
    • CommentTimeAug 10th 2009
     permalink
    ok, he estado leyendo lo que me has puesto.

    ¿Cual debería de modificar: Styles.css o Header.tpl ?
    •  
      CommentAuthorlaborix
    • CommentTimeAug 10th 2009
     permalink
    I'm only a simple fp user, so I think, you must change both files. As I said above, I'm not sure if this is possible in Flatpress. On the other side, a flash animation can be a solution for you?
    •  
      CommentAuthorpulguita
    • CommentTimeAug 10th 2009
     permalink
    Intente poner una animación flash o .swf en el CSS, pero no lo conseguí.

    ¿Como podría poner una animación flash?

    Gracias por la ayuda, laborix.
  1.  permalink
    Also, take a look at this discussion!
    •  
      CommentAuthorpaul
    • CommentTimeAug 25th 2009 edited
     permalink
    Hola/Hi

    I wrote a random header switching code for my flatpress and it works fine.
    http://blog.wbou.de

    It's not beautiful coded, but it works fine. It consists just in a post made static containing something like this:

    [html]
    <script type="text/javascript">
    var titleElementId = "head";
    var imgPath = "/fp-interface/themes/leggero-paul/imgs/topphotos/";

    var imagesToUse = new Array("ahorn.jpg","...", ...);



    var imageSwitchIndex = Math.floor(Math.random()*imagesToUse.length);
    i = imageSwitchIndex;
    var elem = document.getElementById(titleElementId);
    if(elem != null) {
    elem.style.backgroundImage = "url('"+imgPath+imagesToUse[i]+"')";
    elem.style.backgroundRepeat = "no-repeat";
    if (elem.addEventListener){
    elem.addEventListener('click', switchImg, false);
    } else if (elem.attachEvent){
    elem.attachEvent('onclick', switchImg);
    }
    }

    function switchImg() {
    var imageSwitchIndex = Math.floor(Math.random()*imagesToUse.length);
    i = imageSwitchIndex;
    var elem = document.getElementById(titleElementId);
    if(elem != null) {
    elem.style.backgroundImage = "url('"+imgPath+imagesToUse[i]+"')";
    elem.style.backgroundRepeat = "no-repeat";
    }
    }

    </script>
    [/html]


    And this static content has to be put somewhere on the website (using the static content, the blockparser plugin and the admin panel to enable it and position it somewhere)

    Of course it would be more beautiful with a plugin searching automatically for image files in a given directory. But this works for me for the moment.
    •  
      CommentAuthorpaul
    • CommentTimeSep 23rd 2009
     permalink
    Hola otra vez,

    aqui una version escrito como plugin para flatpress:

    <?php
    /*
    Plugin Name: randomheadimg
    Version: 0.1
    Plugin URI: http://blog.wbou.de
    Author: Paul Wellner Bou
    Author URI: http://blog.wbou.de
    */

    add_action('wp_head', 'plugin_randomheadimg_head', 0);

    function plugin_randomheadimg_head() {
    $imgdir = dirname(__FILE__).DIRECTORY_SEPARATOR.'imgs'.DIRECTORY_SEPARATOR;
    $dh = opendir($imgdir);
    $imgs = array();
    while (($file = readdir($dh)) !== false) {
    if(is_dir($imgdir.$file) || $file == '.' || $file == '..')
    continue;
    if(preg_match("/\.(jpg|png|gif)$/i", $file))
    $imgs[] = $file;
    }

    if(count($imgs) == 0)
    return;

    $selected_index = rand(1, count($imgs));
    $selected_img = plugin_geturl('randomheadimg').'imgs/'.$imgs[$selected_index];

    echo <<<RANDOMHEADIMGHEAD
    <!-- start of randomheadimg -->
    <style type="text/css"> #head { background-image: url('$selected_img') !important; } </style>
    <!-- end of randomheadimg -->
    RANDOMHEADIMGHEAD;
    }

    ?>


    Guarda este código como plugins/randomheadimg/plugin.randomheadimg.php.
    Las imagenes tienen que estar en plugins/randomheadimg/imgs/.

    Saludos
    Paul.
    •  
      CommentAuthorlantaca
    • CommentTimeSep 24th 2009 edited
     permalink
    what about a plagin for random image header by category? :D
    •  
      CommentAuthorpaul
    • CommentTimeSep 24th 2009 edited
     permalink
    Feel free to add this feature :-)
    •  
      CommentAuthorlantaca
    • CommentTimeSep 25th 2009
     permalink
    hehe, unfortunatelly i'm not be able to do these :-(

    what about a plagin for random image header by category? :D

    i'm asking you to do that :-)
    •  
      CommentAuthorpaul
    • CommentTimeSep 25th 2009
     permalink
    What do you expect it to do?

    - A default header, if no category is selected
    - If a category is selected, show the category header img

    What should it do when displaying entries? The default header?
    •  
      CommentAuthorlantaca
    • CommentTimeSep 25th 2009
     permalink
    I imagine a plug in that display another header image when i select a particular category.
    So, when i read a post that have a category or i'm browsing all the post of a category, i shoul see the header of its category.
    when there aren't any category or i see the default page of blog (all post), i should see the default header.

    My english is terrible, i know...
    •  
      CommentAuthorpaul
    • CommentTimeSep 25th 2009
     permalink
    And what should it do if a post has more than one category?
    •  
      CommentAuthorpaul
    • CommentTimeSep 25th 2009
     permalink
    Ok, done. What do you prefer? Should the images be named by the name of the category or by the ID?
    Using the ID has the advantage that you can rename the categories without having to change the img file names.
    •  
      CommentAuthorNoWhereMan
    • CommentTimeSep 25th 2009
     permalink
    I didn't test in full, but see if you like this :
    <?php
    /*
    Plugin Name: GlobalCategoryId
    Version: 1.0
    Plugin URI: http://flatpress.org
    Description: Inject a global smarty variable $global_category
    Author: NoWhereMan
    Author URI: http://flatpress.org
    */

    add_filter('wp_head', 'plugin_gi_head');

    function plugin_gi_head() {
    global $smarty, $fpdb;

    // get query object
    $q =& $fpdb->getQuery();


    // default category is 0 ("unfiled" or "all")

    $category = 0;

    // is single entry (comments or permalink)
    if ($q->params->id) {
    list($id, $e) = $q->peekEntry();
    // get FIRST category or returns 0 (unfiled)

    if (isset($e['categories']))
    $category = $e['categories'][0];
    } elseif (isset($q->params->category)) {
    // if we are displaying a single category
    $category = $q->params->category;
    }

    $smarty->assign('global_category', $category);

    }



    now, you'll have a $global_category variable in your THEME
    USAGE, put a class for example on your <body> (in your templates)


    <body class="category-{$global_category}">

    // other stuff



    this will print category-0 if unfiled, or category-123 (where 123 is whatever category ID you chose for some category)

    now, suppose you have a #header id in your css, just define several blocks as follows, one for each category id


    body.category-0 #header {
    background: url(../imgs/image-for-category-0.png);
    }


    body.category-123 #header {
    background: url(../imgs/image-for-category-123.png);
    }

    ...




    please notice the images will go in your theme/THEMENAME/STYLENAME/imgs/ directory

    also, another tip if you're a theme designer: this code can be put right in your style.conf.php or theme.conf.php

    HTH have fun
    •  
      CommentAuthorpaul
    • CommentTimeSep 25th 2009
     permalink
    Better than my approach. Nevertheless, I uploaded my version to my page, too.
    The images has to be named <category>.jpg (or <cat-id>.jpg) and default.jpg. All lowercase and white space characters stripped. They have to be saved into the plugin's img directory, similar to my other header plugin.

    http://blog.wbou.de/flatpress
    •  
      CommentAuthorNoWhereMan
    • CommentTimeSep 25th 2009 edited
     permalink
    hint: this approach (spitting out classes on the body tag) is cool for other nice tricks;

    e.g. you could print a weekday (using day-{$smarty.now|date_format:"%w"} or %u ) and have a different header/graphic for each day of the week;

    a similar trick could work with the hours of the day: imagine a header changing whether it's morning, afternoon, evening or night

    have fun :)
    •  
      CommentAuthorlantaca
    • CommentTimeOct 9th 2009
     permalink
    Posted By: paulBetter than my approach. Nevertheless, I uploaded my version to my page, too.
    The images has to be named .jpg (or .jpg) and default.jpg. All lowercase and white space characters stripped. They have to be saved into the plugin's img directory, similar to my other header plugin.

    http://blog.wbou.de/flatpress


    it warks but when i read a post of a category, i see the default header and not the header of its category. Is possible to do it?

    another question: is possible to assign a category to the static page?
    •  
      CommentAuthorlantaca
    • CommentTimeOct 30th 2009
     permalink
    Up...
    •  
      CommentAuthorlantaca
    • CommentTimeNov 4th 2009
     permalink
    any ideas?
    •  
      CommentAuthorNoWhereMan
    • CommentTimeNov 5th 2009 edited
     permalink
    Posted By: lantaca another question: is possible to assign a category to the static page?


    not at the moment