forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: lordprodigy on January 27, 2006, 08:03:21 pm

Title: add news block next to gallery table
Post by: lordprodigy on January 27, 2006, 08:03:21 pm
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 (http://www.b514.com/images/tmp/b514-org.jpg), what i need is > http://www.b514.com/images/tmp/b514-mod.jpg (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!
Title: Re: anycontent.php
Post by: lordprodigy on January 27, 2006, 09:59:28 pm
anyone any ideas?
Title: Re: add news block next to gallery table
Post by: Joachim Müller on January 28, 2006, 12:05:40 pm
This is possible, but not with anycontent. Search the board for "custom header / footer"
Title: Re: add news block next to gallery table
Post by: lordprodigy on January 30, 2006, 04:05:21 pm
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!
Title: Re: add news block next to gallery table
Post by: lordprodigy on January 31, 2006, 10:38:18 pm
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!
Title: Re: add news block next to gallery table
Post by: lordprodigy on February 01, 2006, 06:03:57 pm
after many tests I still cant do it  ??? ... Am I asking something too complicated?
Title: Re: add news block next to gallery table
Post by: Nibbler on February 01, 2006, 06:25:34 pm
Add this into your theme's theme.php.

Code: [Select]
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.
Title: Re: add news block next to gallery table
Post by: lordprodigy on February 01, 2006, 06:37:26 pm
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?
Title: Re: add news block next to gallery table
Post by: Nibbler on February 01, 2006, 06:41:33 pm
You removed what ?
Title: Re: add news block next to gallery table
Post by: lordprodigy on February 01, 2006, 07:41:18 pm
I removed this
Code: [Select]
// 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.
Title: Re: add news block next to gallery table
Post by: Nibbler on February 01, 2006, 07:58:11 pm
I didn't say to do that, I said to add that code into your theme's theme.php.
Title: Re: add news block next to gallery table
Post by: lordprodigy on February 01, 2006, 08:08:14 pm
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!
Title: Re: add news block next to gallery table
Post by: Nibbler on February 01, 2006, 08:12:21 pm
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.
Title: Re: add news block next to gallery table
Post by: lordprodigy on February 01, 2006, 08:25:54 pm
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!!!  :) :) :)
Title: Re: add news block next to gallery table
Post by: lordprodigy on February 01, 2006, 09:16:44 pm
Consider this solved! Many thanks!