Advanced search  

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

Pages: [1]   Go Down

Author Topic: Advanced Custom Options for formatting  (Read 5570 times)

0 Members and 1 Guest are viewing this topic.

ashelby

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 20
    • ArmedForcesPhotos.com
Advanced Custom Options for formatting
« on: March 02, 2007, 06:04:49 am »

I have been playing with Fetch all day, great product, you rock vuud.

I finally have a call set up to a page called rand.php on my main phpbb forum page.

After this in the index.php page in phpbb:

Code: [Select]
// Start output of page

define('SHOW_ONLINE', true);
$page_title = $lang['Index'];

include($phpbb_root_path . 'includes/page_header.'.$phpEx);

$template->set_filenames(array(
'body' => 'index_body.tpl')
);

I put this to call the rand file:

Code: [Select]
//Coppermine Fetch CPMFetch code for random images
include "vids/fetch/rand.php";

Here are the contents of the rand.php file (I added some css classes so it wouldn't get mixed up with my forum CSS, and modded my forum CSS file) :

Code: [Select]
<table align="center" width="100%" class="forumborder">
<tr>
<th class="recentvideos" align="center">
<b>Video Tutorials recently added to our index.</b>
</td>
</tr>

<tr>
<td align="center">


<?php
include "cpmfetch.php";
$objCpm = new cpm("/vids");
$options = array( 'subtitle' => '%t<br>Watched %h times''alttag' => '%c''cellstyle' => 'gen3');
$objCpm->cpm_viewRandomMedia(1,4,$options);
$objCpm->cpm_close();
?>

<a href="vids" style="font-size:10px">see all tutorials</a>
</td>
</tr>
</table>

I mostly post this for others to look at on modding phpbb.

However if you Look at my main page you will notice the text comes out not aligned perfectly.  I know this is due to the thumbs not being the same size.  But, is there a way to get it all lined up, maybe format out an entire table in the processing page.  So it would be like a grid of cells that get pushed out, each row setup for a different type of info.

It's late and I may look at hacking the Fetch code tomorrow.  Maybe this is already built in, and I just missed it.

Also, this would benefit the long titles, as you can see they don't wrap nicely.  Fetch could add something to limit some fields to a certain number of characters.  This would be an added benefit for main page and side bar placement of Fetched items.

Well, let me know if anyone has any ideas. 

Aric

Logged

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: Advanced Custom Options for formatting
« Reply #1 on: March 02, 2007, 06:40:21 am »


You seem like you know what you are doing...  please switch to the dev version - its way better and will be the stable in a few days / weeks (depending on if any bugs are found).  The installation is the in release notes.  Seriously, so much has changed (read the full release notes to see it all ...

http://cpmfetch.fistfullofcode.com/projects/copperminefetch/downloads/releasenote_1.9.11.txt


<?php
include "cpmfetch.php";
$objCpm = new cpm("/vids");
$options = array( 'subtitle' => '%t<br>Watched %h times', 'alttag' => '%c', 'cellstyle' => 'gen3');
$objCpm->cpm_viewRandomMedia(1,4,$options);
$objCpm->cpm_close();
?>

Be careful with the cpm_close() when using it with a forum, some release of cpmfetch would accidentally close a connection if PHP decided to re-use the forums db connection.  If you get strange forum errors about not connecting to the database, just remove the cpm_close line.  No danger in that.  I just like to release connections and not rely on PHP's cleanup to do it.  Also, the dev version (and cpmfetch 2.0 forth, uses a different constructor (in the release notes)

Quote
However if you Look at my main page you will notice the text comes out not aligned perfectly.  I know this is due to the thumbs not being the same size.  But, is there a way to get it all lined up, maybe format out an entire table in the processing page.  So it would be like a grid of cells that get pushed out, each row setup for a different type of info.

Ahhhh, I love a challenge to my code :)

First, the short answer.  What you need to do is pass the information through css or the option array to:

Set the table: width (so it is fixed and does not stretch) - I used 500 (100px for each thumb, plus 25 per for some space)
Set the table to: align=center
Set the cells to:  valign=top, align=center

See the attached screenshots.  I started out with your source code.

Now to do this you can change your css and set css for the table and the cells, or you can pass in raw attributes through the options array.  Its in the docs.

Second:  I plan on redoing the entire table output so that I can support tables, text, pure css, etc...  But that is not going to happen this week.


Quote
It's late and I may look at hacking the Fetch code tomorrow.  Maybe this is already built in, and I just missed it.

If you want to hack it, let me know - I will give you some stuff to do :)

Quote
Also, this would benefit the long titles, as you can see they don't wrap nicely.  Fetch could add something to limit some fields to a certain number of characters.  This would be an added benefit for main page and side bar placement of Fetched items.

I can certainly see the wisdom in limiting stuff... especially the captions and such.  Good idea!

Thanks also for posting the phpbb thing... I've been planning on adding something into the new docs for each of the forums and the best way to embed.  But its on the list...

Stop by anytime.







Logged
Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

ashelby

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 20
    • ArmedForcesPhotos.com
Re: Advanced Custom Options for formatting
« Reply #2 on: March 02, 2007, 03:25:27 pm »

That looks better.  Thanks for the CSS tips, I had thought of that.  I passed in a cellstyle with the class gen3 in my code, this was done through the options array as suggested.

While this CSS workaround works, if someone tried to put in a really long title, it would grow the page vertically and probably come out looking less than pleasant.  I suggest the character limiting option through fetch options array, mentioned previously.

Something like $subtitle_limit, and then programming a function for trimming the string and ending with a ... if desired, or make that an option too ($Subtitle_too_long_char). 

A $SubTitle_char_limit would be good too, for setting the number of characters a word can be long.  I know CPM has this already and defaults to 38 char's, but another one for fetch could be handy, for displaying in tight places.  You already seem like you have great plans to include these things, or similar and I'll beta for you if you'de like. 

I will download the dev version today and look at the changes.  I went with the stable as I wanted to use this in production mode and not have to worry about finding bugs.  :)  I have a few other sites I can test it on though.

Quote
Be careful with the cpm_close() when using it with a forum, some release of cpmfetch would accidentally close a connection if PHP decided to re-use the forums db connection.

Thanks, I'll take it out.  On that note your Quick Start page online says to use cpm_close, while in the same manual on the Start Stop Page it says to use close() without prefixing it with cmp.  I know this is version difference now, but when I was getting errors yesterday I wasn't sure which way was correct.  Just thought you may want to clarify it on the site.

Quote
If you want to hack it, let me know - I will give you some stuff to do

Please forward, I have no job and lots of free time.  I would love to help contribute.

Aric
Logged

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: Advanced Custom Options for formatting
« Reply #3 on: March 02, 2007, 06:54:51 pm »

Something like $subtitle_limit, and then programming a function for trimming the string and ending with a ... if desired, or make that an option too ($Subtitle_too_long_char). 

A $SubTitle_char_limit would be good too, for setting the number of characters a word can be long.  I know CPM has this already and defaults to 38 char's, but another one for fetch could be handy, for displaying in tight places.  You already seem like you have great plans to include these things, or similar and I'll beta for you if you'de like. 

I am thinking of working it in with the placeholder,

so {{aTitle,30}} would limit the album title to 30.  But I will probably try to do something following the standard set for sprintf

http://us2.php.net/manual/en/function.sprintf.php



Quote
I will download the dev version today and look at the changes.  I went with the stable as I wanted to use this in production mode and not have to worry about finding bugs.  :)  I have a few other sites I can test it on though.

Understandable... overall the dev is more stable at this point.  To be safe you can avoid the newer functions.  But you can also wait if you want for a bit.

Quote
Thanks, I'll take it out.  On that note your Quick Start page online says to use cpm_close, while in the same manual on the Start Stop Page it says to use close() without prefixing it with cmp.  I know this is version difference now, but when I was getting errors yesterday I wasn't sure which way was correct.  Just thought you may want to clarify it on the site.

Yeah, the site and docs are being completely redone.  That was also not written with embedding in mind :)


Logged
Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco
Pages: [1]   Go Up
 

Page created in 0.021 seconds with 19 queries.