Autor Zpráva
26lukas26
Profil
http://topodkaz.net/galerie/svedsko-to-robi-dobre a ked prepnem na dalsi obrázok je tam ten istý koment.

Neviem vyriešiť náväznosť comment boxu na url ktorá je jedinečná... poradíte mi?
shaggy
Profil
Stačí si pozrieť zdroják (stránky http://topodkaz.net/galerie/svedsko-to-robi-dobre) a vidíš, kde je chyba:
<div class="fb-comments" data-href="http://topodkaz.net/galerie" data-width="470"></div>
(nenapíšem ti to, dúfam, že to pochopíš sám)
26lukas26
Profil
no jasne ale na aku url to mam prepisat aby to bolo automaticke?
Fisir
Profil
Reaguji na 26lukase26:
na aku url to mam prepisat
Na URL aktuální stránky. Zkus hledat, jestli se nedá nějak zjistit v PHP.

$_SERVER['REQUEST_URI']
26lukas26
Profil
Nevyznam sa... vedel by si ho najst?

<?php
/**
Template Name: Gallery
 */

global $wpdb;
if(!get_query_var('pid')){
    $first_slug = $wpdb->get_var("SELECT image_slug FROM wp_ngg_pictures ORDER BY pid desc LIMIT 1");
    wp_redirect(home_url().'/galerie/'.$first_slug);
exit;
}

get_header(); ?>
<style type="text/css">
    #content img {
         width: 100%;
         height: auto;
}
.thumbs {
     height: 55px;
     padding: 10px 0;
}
.thumb {
     width: 80px !important;
     height: auto;
     float: left;
     margin: 0 4px;
}
.thumb.active {
     border: 2px solid;
}
.description {
     width: 100%;
     margin: 10px 0;
     background: #a5cbd6;
     clear: both;
}
.description p {
     padding: 8px;

}
.arrows {
     line-height: 25px;
}
.arrows a {
     text-decoration: none;
color: #01abdd;
}
.arrows>.right{
     float: right;
}
</style>
<div class="container_wrap">

  <div class="container_12">
    <div id="content" class="grid_8">
    
       <?php 
    
                      
$path = $wpdb->get_var("SELECT path FROM wp_ngg_gallery WHERE gid=1");
$current = $wpdb->get_results("SELECT * FROM wp_ngg_pictures WHERE image_slug='".get_query_var('pid')."'");
$nb = 3;
$na = 3;
$images_before = $wpdb->get_results("SELECT * FROM wp_ngg_pictures WHERE pid > ".$current[0]->pid."
    ORDER BY pid asc LIMIT ".$nb);
if(count($images_before) < 3)
     $na += 3 - count($images_before);
$images_after = $wpdb->get_results("SELECT * FROM wp_ngg_pictures WHERE pid < ".$current[0]->pid." 
     ORDER BY pid desc LIMIT ".$na);
if(count($images_after) < 3){
     $nb += 3 - count($images_after);
     $images_before = $wpdb->get_results("SELECT * FROM wp_ngg_pictures WHERE pid > ".$current[0]->pid." 
          ORDER BY pid asc LIMIT ".$nb);
}
$images_before = array_reverse($images_before);
$prev = end($images_before)->image_slug;
$next = $images_after[0]->image_slug;

             ?><center>

</center><br/>
             
             <div class="img"><img src="/<?php echo $path.'/'.$current[0]->filename ?>" alt="" /></div><br/>
             <iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fodkaz.org%2F/galerie/<?php echo $current[0]->image_slug ?>&amp;send=false&amp;layout=standard&amp;width=450&amp;show_faces=false&amp;locale=sk_SK&amp;font&amp;colorscheme=light&amp;action=like&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100%; height:35px;" allowTransparency="true"></iframe>
             <div class="arrows">
                  <span class="left">
                        <?php if($prev): ?>
                        <a href="/galerie/<?php echo $prev ?>">
                             ◄ Predchádzajúce
                        </a>
                        <?php else: ?>
                    ◄ Predchádzajúce
                        <?php endif ?>
                  </span>
                  <span class="right">
                        <?php if($next): ?>
                        <a href="/galerie/<?php echo $next ?>">
                             Nasledujúce ► 
                        </a>
                        <?php else: ?>
                        Nasledujúce ►
                        <?php endif ?>
                  </span>
             </div><center><div class="fb-comments" data-href="http://topodkaz.net/galerie/" data-width="470"></div>


</center> <div class="description"><p><?php echo stripcslashes($current[0]->description) ?></p></div>
             <div class="thumbs">
             <?php foreach($images_before as $image): ?>
             <a href="/galerie/<?php echo $image->image_slug ?>">
             <img src="/<?php echo $path.'/thumbs/thumbs_'.$image->filename ?>" class="thumb" />
             </a>
             <?php endforeach ?>
             <a href="/galerie/<?php echo $current[0]->image_slug ?>">
                  <img src="/<?php echo $path.'/thumbs/thumbs_'.$current[0]->filename ?>" class="thumb active" />
             </a>
             <?php foreach($images_after as $image): ?>
             <a href="/galerie/<?php echo $image->image_slug ?>">
             <img src="/<?php echo $path.'/thumbs/thumbs_'.$image->filename ?>" class="thumb" />
             </a>
             <?php endforeach ?>
             </div>

            </div> <!-- end #content -->
    <?php get_sidebar(); ?>
  </div>

</div>
<?php get_footer(); ?>
Fisir
Profil
Reaguji na 26lukase26:
Řádek 105.

data-href="http://topodkaz.net/<?php echo($_SERVER['REQUEST_URI']); ?>"
26lukas26
Profil
dakujem funguje... :)
annie
Profil *
Dobrý den, chtěla jsem se zeptat na fb komenty. Chtěla bych napsat odkaz do komentů, ale nejde mi ho napsat tak, aby se otevřel do nového okna,když na něho kliknu.
zkoušela jsem takto: <a href="http://www.seznam.cz">Seznam</a>, kde by se měl otevřít seznam, ale mě se to prostě nezobrazí, ta nevím kde dělám chybu. poradí mi někdo? Díky za odpověď

Moderátor Petr ZZZ: Příště si prosím na nesouvisející dotaz založ vlastní vlákno a nepiš do cizího (a vkládej kódy mezi značky [pre] a [/pre] – stačí kliknout na ).
shaggy
Profil
annie:
Hmm, okrem toho, že to nesúvisí s pôvodnou otázkou, tak do FB komentárov nie je možné vkladať html kód.

Vaše odpověď


Prosím používejte diakritiku a interpunkci.

Ochrana proti spamu. Napište prosím číslo dvě-sta čtyřicet-sedm:

0