question about information on the front page of albums... question about information on the front page of albums...
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

question about information on the front page of albums...

Started by disposition, November 12, 2007, 04:11:52 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

disposition

Under each category I have albums for specific things like music an dvideo and what not, I would like everytime someone uploads something for the name of the file to show where it reads "1 files, last one added on Nov 10, 2007" (on the front page.

Hope you can help!
THANKS!


www.blackdeathmetal.com

Joachim Müller

Unrelated to your request, but more important: you're using cpg1.4.8, while the most recent stable release currently is cpg1.4.14. It's absolutely mandatory to upgrade asap.

disposition


Joachim Müller

I can see that you heeded the advice and upgraded to cpg1.4.14 - that's fine. Now we can go ahead.
Not sure what your actual request is; I understand that you want to change the look of the album stats, but I have no idea what you're actually trying to accomplish. Please re-phrase your question, using more words and maybe a made-up example string. Something like
QuoteI want to replace3 files, last one added on Nov 11, 2007with3 files, last one added on Nov 11, 2007 - additional stuff here

disposition

I took your advice and had a smooth update.  Thanks!


Well I uploaded two photos for you to check out, the first photo link is what it looks like now.

http://www.blackdeathmetal.com/aaa/1.jpg

Second is what I want it to look like. Check under VIDEO and album MUSIC VIDEO (on the picture), I added a line in the picture that reads "Latest Update - Death Spiritual Healing Video - Posted by your momma".  That is what I would like it to do, or at least something like.

http://www.blackdeathmetal.com/aaa/2.jpg

Hope this helps and thanks for helping.


www.BLACKDEATHMETAL.com

just_some_guy

#5
I can help you with this one. The location where you want the text to be is in theme.php look for

<p>{ALB_DESC}</p>

to get text there you can type around that.

For the specific query you want you need to call up the information from the database. This bit of code will probebly get you on your way, im not sure what the album id is defined by. I would think it would be $aid like the categories are defined as $cid but you might want to look into this -

$sql ="SELECT * FROM {$CONFIG['TABLE_PICTURES']}  WHERE aid = //What is this defined as\\? ORDER BY mtime DESC LIMIT 1";
$result = cpg_db_query($sql);
while ($row = mysql_fetch_assoc($result)) {
$user_mod = $row['owner_name'];
$name_mod = $row['title'];
}

//Form a sentence, define as a variable

$phrase =  "Lastest upload -  ".$name_mod." Posted by ".$user_mod."";

//Then you can echo this out where you want.


Happy Coding!
Tambien, Hablo Español      PHP - Achieve Anything
"The Internet is becoming the town square for the global village of tomorrow. " - Bill Gates
Windows 7 Forums

disposition

Hey thanks for the reply, although my theme.php does not have that information I am confused on where to put the code.  And I  need you to clarify where to actually put this code, you said anywhere around it, so I am assuming before it or after.

Anyway hope you can still help me out.

disposition

Oh yeah I used the BLACKBIRCH theme and the theme.php doesn't really have anything in it.

Joachim Müller

If a particular section doesn't exist in your theme.php, copy the corresponding section that needs changing (and only that section) from themes/sample/theme.php into a new line before?>of themes/yourtheme/theme.php, then modify as you see fit / as suggested here. The stuff you need to copy from the sample theme in your case is// HTML template for the album list
$template_album_list = <<<EOT

<!-- BEGIN stat_row -->
        <tr>
                <td colspan="{COLUMNS}" class="tableh1" align="center"><span class="statlink">{STATISTICS}</span></td>
        </tr>
<!-- END stat_row -->
<!-- BEGIN header -->
        <tr class="tableb_compact">
<!-- END header -->
<!-- BEGIN album_cell -->
        <td width="{COL_WIDTH}%" valign="top">
        <table width="100%" cellspacing="0" cellpadding="0">
        <tr>
                <td colspan="3" height="1" align="left" valign="top" class="tableh2">
                        <span class="alblink"><a href="{ALB_LINK_TGT}"><b>{ALBUM_TITLE}</b></a></span>
                </td>
        </tr>
        <tr>
                <td colspan="3">
                        <img src="images/spacer.gif" width="1" height="1" border="0" alt="" /><br />
                </td>
        </tr>
        <tr>
                <td align="center" valign="middle" class="thumbnails">
                        <img src="images/spacer.gif" width="{THUMB_CELL_WIDTH}" height="1" class="image" style="margin-top: 0px; margin-bottom: 0px; border: none;" alt="" /><br />
                        <a href="{ALB_LINK_TGT}" class="albums">{ALB_LINK_PIC}<br /></a>
                </td>
                <td>
                        <img src="images/spacer.gif" width="1" height="1" border="0" alt="" />
                </td>
                <td width="100%" valign="top" align="left" class="tableb_compact">
                        {ADMIN_MENU}
                        <p>{ALB_DESC}</p>
                        <p class="album_stat">{ALB_INFOS}</p>
                </td>
        </tr>
        </table>
        </td>
<!-- END album_cell -->
<!-- BEGIN empty_cell -->
        <td width="{COL_WIDTH}%" valign="top">
        <table width="100%" cellspacing="0" cellpadding="0">
        <tr>
                <td height="1" valign="top" class="tableh2">
                        <b>&nbsp;</b>
                </td>
        </tr>
        <tr>
                <td>
                        <img src="images/spacer.gif" width="1" height="1" border="0" alt="" /><br />
                </td>
        </tr>
        <tr>
                <td width="100%" valign="top" class="tableb_compact">
                    <div class="thumbnails" style="background-color:transparent"><img src="images/spacer.gif" width="1" height="{SPACER}" border="0" class="image" style="border:0;margin-top:1px;margin-bottom:0" alt="" /></div>
                </td>
        </tr>
        </table>
        </td>
<!-- END empty_cell -->
<!-- BEGIN row_separator -->
        </tr>
        <tr class="tableb_compact">
<!-- END row_separator -->
<!-- BEGIN footer -->
        </tr>
<!-- END footer -->
<!-- BEGIN tabs -->
        <tr>
                <td colspan="{COLUMNS}" style="padding: 0px;">
                        <table width="100%" cellspacing="0" cellpadding="0">
                                <tr>
                                       {TABS}
                                </tr>
                        </table>
                </td>
        </tr>
<!-- END tabs -->
<!-- BEGIN spacer -->
        <img src="images/spacer.gif" width="1" height="7" border="" alt="" /><br />
<!-- END spacer -->

EOT;

just_some_guy

Juding by your screen shots your albums dont have any description so adding the code like this shouldnt do any harm. If it does then you will need to move the code to a different place.

<p>{ALB_DESC}
<?php echo "$phrase"?></p>
Tambien, Hablo Español      PHP - Achieve Anything
"The Internet is becoming the town square for the global village of tomorrow. " - Bill Gates
Windows 7 Forums

disposition

I am rather new at this but I put that bit of code before ?> and it did not seem to give me errors, but I am stumped at what to do now and even if I am doing this correct!  I saw no difference on the site so I am assuming I am very slow at getting this for some reason. Please advise on my mistake. 

I also replaced

<p>{ALB_DESC}</p> <p class="album_stat">{ALB_INFOS}</p>

with

< p>{ALB_DESC} <?php echo "$phrase"; ?></p>

Not sure if that was the right thing to do or not.

Thanks!


<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2005 Coppermine Dev Team
  v1.1 originaly written by Gregory DEMAR

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
  ********************************************
  Coppermine version: 1.4.1
  $Source:
  $Revision: 1.10 $
  $Author:
  $Date: 2005/04/30 07:13:16 $
**********************************************/


// HTML template for template sys_menu spacer
$template_sys_menu_spacer ='::';

// HTML template for the album list
$template_album_list = <<<EOT

<!-- BEGIN stat_row -->
        <tr>
                <td colspan="{COLUMNS}" class="tableh1" align="center"><span class="statlink">{STATISTICS}</span></td>
        </tr>
<!-- END stat_row -->
<!-- BEGIN header -->
        <tr class="tableb_compact">
<!-- END header -->
<!-- BEGIN album_cell -->
        <td width="{COL_WIDTH}%" valign="top">
        <table width="100%" cellspacing="0" cellpadding="0">
        <tr>
                <td colspan="3" height="1" align="left" valign="top" class="tableh2">
                        <span class="alblink"><a href="{ALB_LINK_TGT}"><b>{ALBUM_TITLE}</b></a></span>
                </td>
        </tr>
        <tr>
                <td colspan="3">
                        <img src="images/spacer.gif" width="1" height="1" border="0" alt="" /><br />
                </td>
        </tr>
        <tr>
                <td align="center" valign="middle" class="thumbnails">
                        <img src="images/spacer.gif" width="{THUMB_CELL_WIDTH}" height="1" class="image" style="margin-top: 0px; margin-bottom: 0px; border: none;" alt="" /><br />
                        <a href="{ALB_LINK_TGT}" class="albums">{ALB_LINK_PIC}<br /></a>
                </td>
                <td>
                        <img src="images/spacer.gif" width="1" height="1" border="0" alt="" />
                </td>
                <td width="100%" valign="top" align="left" class="tableb_compact">
                        {ADMIN_MENU}
                       <p>{ALB_DESC}
<?php echo "
$phrase"; ?>
</p>
                </td>
        </tr>
        </table>
        </td>
<!-- END album_cell -->
<!-- BEGIN empty_cell -->
        <td width="{COL_WIDTH}%" valign="top">
        <table width="100%" cellspacing="0" cellpadding="0">
        <tr>
                <td height="1" valign="top" class="tableh2">
                        <b>&nbsp;</b>
                </td>
        </tr>
        <tr>
                <td>
                        <img src="images/spacer.gif" width="1" height="1" border="0" alt="" /><br />
                </td>
        </tr>
        <tr>
                <td width="100%" valign="top" class="tableb_compact">
                    <div class="thumbnails" style="background-color:transparent"><img src="images/spacer.gif" width="1" height="{SPACER}" border="0" class="image" style="border:0;margin-top:1px;margin-bottom:0" alt="" /></div>
                </td>
        </tr>
        </table>
        </td>
<!-- END empty_cell -->
<!-- BEGIN row_separator -->
        </tr>
        <tr class="tableb_compact">
<!-- END row_separator -->
<!-- BEGIN footer -->
        </tr>
<!-- END footer -->
<!-- BEGIN tabs -->
        <tr>
                <td colspan="{COLUMNS}" style="padding: 0px;">
                        <table width="100%" cellspacing="0" cellpadding="0">
                                <tr>
                                       {TABS}
                                </tr>
                        </table>
                </td>
        </tr>
<!-- END tabs -->
<!-- BEGIN spacer -->
        <img src="images/spacer.gif" width="1" height="7" border="" alt="" /><br />
<!-- END spacer -->

EOT;?>

Joachim Müller

<?php echo "$phrase"?>is of course nonsense and won't do anything.

just_some_guy

Tambien, Hablo Español      PHP - Achieve Anything
"The Internet is becoming the town square for the global village of tomorrow. " - Bill Gates
Windows 7 Forums

Stramm

won't do any useful either...
1. we're in a heredoc here, echo would just print as echo and won't be parsed as function
2. $phrase isn't defined. Output of nothing is nothing. In addition to that you should set vars in heredocs in curly brackets

@disposition: if you get errors, then post them. Otherwise it's not possible to give you advice.

disposition

I apopreciate all your help, but I am so new to PHP and I feel a bit overwhelmed here.  Am I supposed to put this code into theme or not and what is necessary to put in, It seems that some code is not necessary and some is, I am so confused, I put the code into my theme and it does nothing.  Am I supposed to edit something in this code?

disposition

It would be cool if it just grabbed the information from "Latest additions".

just_some_guy

The code i gave you should work fine to actually "grab" the data. It just matter of printing it out.
Tambien, Hablo Español      PHP - Achieve Anything
"The Internet is becoming the town square for the global village of tomorrow. " - Bill Gates
Windows 7 Forums

disposition

What does that mean?

I added that to my theme.php so should I expect that it should be working now?  I am just trying to re out what I should do now.

just_some_guy

Well basically in non coding terms. Think of it this way your solving a maths sum -  you have thought of the answer - its just a case of writing down the answer. Hope it makes makes more sense.

NB you still need to find out what the aid is in the file.
Tambien, Hablo Español      PHP - Achieve Anything
"The Internet is becoming the town square for the global village of tomorrow. " - Bill Gates
Windows 7 Forums

disposition

O.K. I get that.

I still need to know what the aid is int he first place, remember I am not very familiar in PHP and as you can see I am trying to learn here, and so far I am doing O.K.

What is aid?
What file is that code grabbing from? If that even makes sense.
As I said I have the code down on my theme.php but I just don't get it.

Obviously I am just not getting this, maybe it is just way over my head for a beginner and of course I appreciate your help alot.  If there is a way to get this done that would be great if you can give me more help, if you are just fed up woth me I will try again when I learn more.

thanks