add news block next to gallery table add news block next to gallery table
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

add news block next to gallery table

Started by lordprodigy, January 27, 2006, 08:03:21 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

lordprodigy

Hello,

I would like to add a news block on my site, right besides the main gallery table (original - http://www.b514.com/images/tmp/b514-org.jpg, what i need is > http://www.b514.com/images/tmp/b514-mod.jpg). I know I can do it with anycontent.php but I dont know which files need to be edited.

Thank you very much in advance!

lordprodigy


Joachim Müller

This is possible, but not with anycontent. Search the board for "custom header / footer"

lordprodigy

thank you!

I searched as you told me and I saw a lot of content which refers to adding a custom header or footer. My request fits after the header and infact I believe is has to be inside the {gallery} (as i want the news block to be side by side with the gallery content table). Please take a look at the images i posted above and let me know roughly how I can do that. Some links to forum topics dealing with that will also do the job. I appreciate all your help! Great support!

lordprodigy

Can this thread be moved into the support forum for 1.4.x. I upgraded my gallery to 1.4.3 so this request is still valid but for the new version. I tried to add iframe code into the theme.php which worked but wasnt able to create a table with two colums (one used by the news iframe and the other by the category table)

Any suggestions anyone? thanks for all the help!

lordprodigy

after many tests I still cant do it  ??? ... Am I asking something too complicated?

Nibbler

Add this into your theme's theme.php.


function theme_display_cat_list($breadcrumb, &$cat_data, $statistics)
{
    global $template_cat_list, $lang_cat_list;
    if (count($cat_data) > 0) {
echo '<table width="100%"><tr><td valign="top">';
starttable("100%");
echo <<< EOT

<tr>
<td class="tableh1"><b>News</b></td>
</tr>
<tr>
<td class="tableb">
Your content here
</td>
</tr>
<tr>
<td class="tableh1">&nbsp;</td>
</tr>

EOT;

endtable();
echo '</td><td>';
        starttable('100%');
        $template = template_extract_block($template_cat_list, 'header');
        $params = array('{CATEGORY}' => $lang_cat_list['category'],
            '{ALBUMS}' => $lang_cat_list['albums'],
            '{PICTURES}' => $lang_cat_list['pictures'],
            );
        echo template_eval($template, $params);
    }

    $template_noabl = template_extract_block($template_cat_list, 'catrow_noalb');
    $template = template_extract_block($template_cat_list, 'catrow');
    foreach($cat_data as $category) {
        if (count($category) == 3) {
            $params = array('{CAT_TITLE}' => $category[0],
                    '{CAT_THUMB}' => $category['cat_thumb'],
                '{CAT_DESC}' => $category[1]
                );
            echo template_eval($template_noabl, $params);
        } elseif (isset($category['cat_albums']) && ($category['cat_albums'] != '')) {
            $params = array('{CAT_TITLE}' => $category[0],
                '{CAT_THUMB}' => $category['cat_thumb'],
                '{CAT_DESC}' => $category[1],
                '{CAT_ALBUMS}' => $category['cat_albums'],
                '{ALB_COUNT}' => $category[2],
                '{PIC_COUNT}' => $category[3],
                );
            echo template_eval($template, $params);
        } else {
            $params = array('{CAT_TITLE}' => $category[0],
                '{CAT_THUMB}' => $category['cat_thumb'],
                '{CAT_DESC}' => $category[1],
                '{CAT_ALBUMS}' => '',
                '{ALB_COUNT}' => $category[2],
                '{PIC_COUNT}' => $category[3],
                );
            echo template_eval($template, $params);
        }
    }

    if ($statistics && count($cat_data) > 0) {
        $template = template_extract_block($template_cat_list, 'footer');
        $params = array('{STATISTICS}' => $statistics);
        echo template_eval($template, $params);
    }


    if (count($cat_data) > 0){
endtable();
echo '</td></tr></table>';
}
        echo template_extract_block($template_cat_list, 'spacer');
}


That should get you most of the way there.

lordprodigy

Thank you so much!!! But there is a little problem... I removed the code for category list  and breadcrumbs and pasted this one instead. However I get a blank page with nothing rendered on it. Did I do anything wrong?


lordprodigy

I removed this// HTML template for the category list
$template_cat_list = <<<EOT
<!-- BEGIN header -->
        <tr>
                <td class="tableh1" width="80%" align="left"><b>{CATEGORY}</b></td>
                <td class="tableh1" width="10%" align="center"><b>{ALBUMS}</b></td>
                <td class="tableh1" width="10%" align="center"><b>{PICTURES}</b></td>
        </tr>
<!-- END header -->
<!-- BEGIN catrow_noalb -->
        <tr>
                <td class="catrow_noalb" colspan="3"><table border="0"><tr><td align="left">{CAT_THUMB}</td><td align="left"><span class="catlink"><b>{CAT_TITLE}</b></span>{CAT_DESC}</td></tr></table></td>
        </tr>
<!-- END catrow_noalb -->
<!-- BEGIN catrow -->
        <tr>
                <td class="catrow" align="left"><table border="0"><tr><td>{CAT_THUMB}</td><td><span class="catlink"><b>{CAT_TITLE}</b></span>{CAT_DESC}</td></tr></table></td>
                <td class="catrow" align="center">{ALB_COUNT}</td>
                <td class="catrow" align="center">{PIC_COUNT}</td>
        </tr>
        <tr>
            <td class="tableb" colspan="3">{CAT_ALBUMS}</td>
        </tr>
<!-- END catrow -->
<!-- BEGIN footer -->
        <tr>
                <td colspan="3" class="tableh1" align="center"><span class="statlink"><b>{STATISTICS}</b></span></td>
        </tr>
<!-- END footer -->
<!-- BEGIN spacer -->
        <img src="images/spacer.gif" width="1" height="7" border="" alt="" /><br />
<!-- END spacer -->

EOT;
// HTML template for the breadcrumb
$template_breadcrumb = <<<EOT
<!-- BEGIN breadcrumb -->
        <tr>
                <td colspan="3" align="left" class="tableh1"><span class="statlink"><b>{BREADCRUMB}</b></span></td>
        </tr>
<!-- END breadcrumb -->
<!-- BEGIN breadcrumb_user_gal -->
        <tr>
                <td colspan="3" class="tableh1">
                <table width="100%" cellpadding="0" cellspacing="0" border="0">
                <tr>
                        <td align="left"><span class="statlink"><b>{BREADCRUMB}</b></span></td>
                        <td align="right"><span class="statlink"><b>{STATISTICS}</b></span></td>
                </tr>
                </table>
                </td>
        </tr>
<!-- END breadcrumb_user_gal -->

EOT;


and replaced it with your code.

Nibbler

I didn't say to do that, I said to add that code into your theme's theme.php.

lordprodigy

I did that. I get a blank page with nothing on it  :( I am definitely doing something wrong. Can you take a look at the theme.php please? Million thanks!

Nibbler

Why do you have so much in there ?

You already have a theme_display_cat_list() function in there, you need to remove that or merge your changes with mine.

lordprodigy

you are right. foolish of me. I corrected it and its working!!!! now there is cosmetic work to be done :) Thanks a lot!!! take a look if you like http://www.bogho.com/b514/index.php this is my test platform before I really upgrade B514 ... :)

I am going to add an iframe with a news file which I can update regularly. How can I make the news table to be the same height as the category table, and the space between them to be 1 px.. i.e to look like ONE multifunctional table?..This is no rush so whenever you have time.

THANKS A LOT for all the help!!!  :) :) :)

lordprodigy