• Welcome to PHPVIBE Forums. Please log in.

[ Video Sharing CMS v4 ] Home page block title links...

Started by hunt07777,

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

hunt07777Topic starter

Mario...

When I build a home page block,
And the title of the block appears...on the homepage...
Any chance I can link the title.
http://screencast.com/t/69fbkAv7M0VQ

Cause when a user scrolls down a long page..http://screencast.com/t/pNJpuNwv7
no channel list is on the left...

I looked in...
functions.php line 732, and found...

$label = '<a href="'.channel_url($cat->id, $cat->name).'" title="'. stripslashes($cat->name).'">'. stripslashes($cat->name).'[/url]';


But didnt' properly know how to add that to the header...
video-loop.php line 3
if(!empty($heading)) { echo '<h3 class="loop-heading"><span>'.stripslashes($heading).'</span></h3>';}

And was wondering if you could show me how.

Thanks so much.

Also, do you think this is a good thing to do for your core script? I do.

  •  

Marius P.

Why you never use the code tags? :)
It's an extra query attachment and I prefer to keep it as light as possible as when you'll have a tone of videos, your server will feel every single little extra query...
Best would be a jquery solution to make the cats list fixed on scrolling.
Happy with my help? Buy me a coffee.
Please, always use the search before opening a new topic! We're all here on our (limited) free time! Make sure you help yourself too!
  •  

sanishan

Quote from: hunt07777 on
Mario...

When I build a home page block,
And the title of the block appears...on the homepage...
Any chance I can link the title.


I don't know the other way its required extra query to achive the target.

In sometime in your BLOCK you did not select the category then you need extra query, otherwise just need to edit existed to done your work.

If you always select the category for block edit this.

open /tpl/main/home.php

Find
$boxes = $db->get_results("SELECT * FROM ".DB_PREFIX."homepage ORDER BY `order`,`id` ASC");


Replace with:
$boxes = $db->get_results("SELECT * FROM ".DB_PREFIX."homepage LEFT JOIN ".DB_PREFIX."channels ON ".DB_PREFIX."homepage.ident=".DB_PREFIX."channels.cat_id ORDER BY `order`,`id` ASC");


Find:
$heading = $box->title;


Replace with:
$heading = '<a href="'.$url=channel_url($box->id, $box->cat_name).'">'.$box->title.'[/url]';




Other wise use this required extra query for every single block:


Find:
if(!empty($box->ident)){


Add After:
$heading_link= $db->get_row("SELECT * FROM ".DB_PREFIX."homepage  ORDER BY `order`,`id` ASC");
    if ($heading_link){
        
        $heading = '<a href="'.$url=channel_url($heading_link->id, $heading_link->cat_name).'">'.$heading_link->title.'[/url]';
    }


You have to done the Link style by yourself.

THanks,
Free PHPVibe Professional Customized Plugin http://phpvibemod.com/
  •  

Marius P.

It's a bit funky, as if he doesn't have a channel for that block it will return an invalid link.

Isn't this a better approach?
if(isset($box->ident) && !empty($box->ident)){ 
$heading = '<a href="'.$url=channel_url($box->id, $box->cat_name).'">'.$box->title.'[/url]';
} else {
$heading = $box->title;
}



Thank you Sanishan! I'm making an massive upgrade to the admin panel and I didn't had time to look into it, but when you see the code like this, you realise improvements and you make them fast! Thanks for all the good work you do around!
Happy with my help? Buy me a coffee.
Please, always use the search before opening a new topic! We're all here on our (limited) free time! Make sure you help yourself too!
  •  

sanishan

Quote from: @Mario on
It's a bit funky, as if he doesn't have a channel for that block it will return an invalid link.

Isn't this a better approach?
if(isset($box->ident) && !empty($box->ident)){ 
$heading = '<a href="'.$url=channel_url($box->id, $box->cat_name).'">'.$box->title.'[/url]';
} else {
$heading = $box->title;
}



Thank you Sanishan! I'm making an massive upgrade to the admin panel and I didn't had time to look into it, but when you see the code like this, you realise improvements and you make them fast! Thanks for all the good work you do around!

Thanks Mario for fixing the code, I just create this code to too fast for got to fix the undefined  error..

Free PHPVibe Professional Customized Plugin http://phpvibemod.com/
  •  

hunt07777Topic starter

Well..
I did what you said...
but the links didnt' match the channel numbers...
Apparently I didn't create them in the same order?


So I had to remove it.
  •  

Marius P.

if(isset($box->ident) && !empty($box->ident)){ 
$heading = '<a href="'.$url=channel_url($box->ident, $box->cat_name).'">'.$box->title.'[/url]';
} else {
$heading = $box->title;
}



My bad, this should work, i've passed the id of the box, instead of the category.
Happy with my help? Buy me a coffee.
Please, always use the search before opening a new topic! We're all here on our (limited) free time! Make sure you help yourself too!
  •  

hunt07777Topic starter

Perfect! Thank you so much...
I did notice tho.. above in your script in 2 places you have [/url] instead of
</a>


so for the newcomer.. the final code that worked for me. is..

//$boxes = $db->get_results("SELECT * FROM ".DB_PREFIX."homepage ORDER BY `order`,`id` ASC");
(commented out old by putting 2 //)
$boxes = $db->get_results("SELECT * FROM ".DB_PREFIX."homepage LEFT JOIN ".DB_PREFIX."channels ON ".DB_PREFIX."homepage.ident=".DB_PREFIX."channels.cat_id ORDER BY `order`,`id` ASC");

//$heading = $box->title;
$heading = '<a href="'.$url=channel_url($box->id, $box->cat_name).'">'.$box->title.'</a>';

if(!empty($box->ident)){ $c_add ="AND category = '".intval($box->ident)."'"; }
    if(isset($box->ident) && !empty($box->ident)){
        $heading = '<a href="'.$url=channel_url($box->ident, $box->cat_name).'">'.$box->title.'</a>';
    } else {
        $heading = $box->title;
    }


Thank you guys.. this is an awesome and major improvement!
  •  

PHPVibe A.


rauljoseph

Quote from: hunt07777 on
Perfect! Thank you so much...
I did notice tho.. above in your script in 2 places you have [/url] instead of
</a>


so for the newcomer.. the final code that worked for me. is..

//$boxes = $db->get_results("SELECT * FROM ".DB_PREFIX."homepage ORDER BY `order`,`id` ASC");
(commented out old by putting 2 //)
$boxes = $db->get_results("SELECT * FROM ".DB_PREFIX."homepage LEFT JOIN ".DB_PREFIX."channels ON ".DB_PREFIX."homepage.ident=".DB_PREFIX."channels.cat_id ORDER BY `order`,`id` ASC");

//$heading = $box->title;
$heading = '<a href="'.$url=channel_url($box->id, $box->cat_name).'">'.$box->title.'</a>';

if(!empty($box->ident)){ $c_add ="AND category = '".intval($box->ident)."'"; }
    if(isset($box->ident) && !empty($box->ident)){
        $heading = '<a href="'.$url=channel_url($box->ident, $box->cat_name).'">'.$box->title.'</a>';
    } else {
        $heading = $box->title;
    }


Thank you guys.. this is an awesome and major improvement!


where do i use this code?
Do i replace an existing one with this?
Please explain.

Thanks
  •  

hunt07777Topic starter

rauljoseph,

Instead of trying to explain again.. I have attached the full file.... which will be easier if you haven't made any other changes to the file, or don't have to merge. Thanks.

You'll have to change the home.txt to home.php.

Hope that helps.
  •  

rauljoseph

  •  

lienkhuong

  •  

lienkhuong

@Mario with home page title link you can help me in v4, code above doesn't work in v4

Thank
  •  

lienkhuong

@Alexander

can you help me? " home page title link you can help me in v4, code above doesn't work in v4"
  •  

zeepakos

Hello can any one help.me i want to show block title with link i follow this rules but i get error homepage blocks not found can anyone help me please.
  •  

Similar topics (7)