Need help with understanding OptionsArray Need help with understanding OptionsArray
 

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

Need help with understanding OptionsArray

Started by Amazulu, March 16, 2007, 09:05:40 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Amazulu

First of all I would like to thank you Vuud for creating this "mod" for Coppermine. It will be very useful to me as I go about developing my steadily growing site (www.nikongear.com).

It only took me half an afternoon but I finally got it working on a test page of my site's main index.php. There are, however, a few things I am having some trouble understanding and this is probably because I only have about half an afternoon's experience in working with PHP! I have read the documentation but I'm afraid it is a little bit above my level of understanding, so if you could please be just a tad gentle with me I will try to follow as best I can.

If you go to this page: http://nikongear.com/index_test.php you will see right at the bottom of the page that I have successfully got CpmFetch to display the last three uploads to Coppermine on a single line. However, there are some issues I would like to find a quick answer to:

1. How do I get these images to align center with the page content? I am pretty sure it has something to do with the optionsArray thingy, but the help assumes some level of competence with PHP. As mentioned I have like under a days experience, so this is not all that helpful to me. I just don't quite know what is going on there.

2. When I include the code to close CpmFetch at the end of my page I get an error displayed on the resultant page. I have removed that code and it seems to be working, but I am unsure as to whether this is the right thing to do.

Any pointers will be greatly appreciated.

vuud

Quote from: Amazulu on March 16, 2007, 09:05:40 AM
First of all I would like to thank you Vuud for creating this "mod" for Coppermine. It will be very useful to me as I go about developing my steadily growing site (www.nikongear.com).

It's not a mod.  Mod (or modification) I feel implies that you have to change the CPG code, which makes upgrading a pain.  This is more of an add-on or an accessory.  In any case, thank you for saying so, and I hope it helps you much!

Quote
It only took me half an afternoon but I finally got it working on a test page of my site's main index.php. There are, however, a few things I am having some trouble understanding and this is probably because I only have about half an afternoon's experience in working with PHP! I have read the documentation but I'm afraid it is a little bit above my level of understanding, so if you could please be just a tad gentle with me I will try to follow as best I can.

If you go to this page: http://nikongear.com/index_test.php you will see right at the bottom of the page that I have successfully got CpmFetch to display the last three uploads to Coppermine on a single line. However, there are some issues I would like to find a quick answer to:

We all start somewhere.  You got this far, so you obviously have sufficent grey matter to learn programming.  I am not sure what version you are using, but the dev version is the best at this point (It will be stable in a about a week and is years newer than the stable now).

Quote
1. How do I get these images to align center with the page content? I am pretty sure it has something to do with the optionsArray thingy, but the help assumes some level of competence with PHP. As mentioned I have like under a days experience, so this is not all that helpful to me. I just don't quite know what is going on there.

Align center vertically?  Whatever html you have enclosing it should set a valign tag...  I am not entirely sure I understand the question.


Quote
2. When I include the code to close CpmFetch at the end of my page I get an error displayed on the resultant page. I have removed that code and it seems to be working, but I am unsure as to whether this is the right thing to do.

I would recommend something, but I really need the error to tell you what to do...  In fact, that is probably the best tip:  If you ever post mentioning an error, you have to include the exact error.  Your a camera guy right?  If I said, dude, I am having a problem with my extender lense tube thing, what should I do to fix it?  See my point.

That being said, you can ALWAYS leave out the cpm_close().  PHP will clean up after you in the end and close DB connections and such.  I think the dev version may detect if its reusing one and not close it even if you call it.


From your page, it seems as though its in a forum, so when you call the close, its probably yanking the connection out from under the forum - but without an error, I would not know for sure!

Quote
Any pointers will be greatly appreciated.

Don't run with scissors.  Honestly, I guess I have two thoughts:

1) Upgrade to the latest dev
2) Post the code you are using if you want tips on it. 


The eagle pic is really amazing



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

Amazulu

Thanks vuud.

Here's the code for the centre table on that index page, which is an external page that provides a summary of what is going on with the forum as well as a few other things I update manually:

<td valign="top">
                          <p align="center"><?php ssi_welcome(); ?></p>
                          <p align="center"><strong>Our Pic Of The Week</strong> <br>
                            <img src="Photos/POTW/POTW_29_jimfenton.jpg" width="600" height="467" border="2"><br>
                             by Jim Fenton was originally spotted <a href="http://nikongear.com/smf/index.php?topic=3440.0">here</a>. This image was chosen by Seymore. </p>
                          <p align="center"><strong>Latest Forum Topics:</strong></p>
                        <p align="center"><?php ssi_recentTopics(); ?></p><br>
                  <p align="center"><strong>Who's Online:</strong></p>
                  <p align="center"><?php ssi_whosOnline(); ?></p><br>
                  <p align="center"><strong>What's News?</strong></p>
                  <p align="center"><?php ssi_news(); ?></p><br>
                  <p align="center"><strong>On our calendar today:</strong></p>
                  <p align="center"><?php ssi_recentEvents(); ?></p>
                  <p align="center"><strong>Recently added to the lightboxes:</strong></p>
                  <p align="center"><?php $objCpm->cpm_viewLastAddedMedia(1,3) ?></p></td>

Now I am not a whizzkid with HTML - I rely a lot on Dreamweaver to build the code for me, but I am slowly starting to learn how to do these things myself. From what I see above, the call to the CpmFetch function is enclosed in a centered <p> tag. This works fine for the SMF SSI calls you see above the final CpmFetch one, but for some reason the table generated by the CpmFetch command is returning content that is aligned to the left. It doesn't look so bad in a 1024x768 screen res, but anything bigger (like what 80% of my users are on) and it looks a bit odd. Would like to have it centered under the output from SMF's SSI stuff, as well as learn how to display perhaps some other detail or formatting.

I used to be a Unisys 2200 mainframe programmer (Mapper) about 15 years ago, so I have a limited understanding of programming in a PC environment. The PHP stuff is great! Really enjoying seeing all the things that are possible and am hoping to continue the learning to the point where I can develop my own applications and start taking my sites to a new level. I can't begin to explain how much closer to understanding the workings of PHP your "add-on" has provided me.

Will wait until your dev version is declared stable before I upgrade (am working with the latest stable version, 1.6.4 - I think?), but thanks for the hint.

Yep, that eagle shot is a pearler! We have some very talented guys (and gals) on Nikongear.

vuud

Quote from: Amazulu on March 16, 2007, 06:03:57 PM
Thanks vuud.

Here's the code for the centre table on that index page, which is an external page that provides a summary of what is going on with the forum as well as a few other things I update manually:

<td valign="top">
                          <p align="center"><?php ssi_welcome(); ?></p>
                          <p align="center"><strong>Our Pic Of The Week</strong> <br>
                            <img src="Photos/POTW/POTW_29_jimfenton.jpg" width="600" height="467" border="2"><br>
                             by Jim Fenton was originally spotted <a href="http://nikongear.com/smf/index.php?topic=3440.0">here</a>. This image was chosen by Seymore. </p>
                          <p align="center"><strong>Latest Forum Topics:</strong></p>
                        <p align="center"><?php ssi_recentTopics(); ?></p><br>
                  <p align="center"><strong>Who's Online:</strong></p>
                  <p align="center"><?php ssi_whosOnline(); ?></p><br>
                  <p align="center"><strong>What's News?</strong></p>
                  <p align="center"><?php ssi_news(); ?></p><br>
                  <p align="center"><strong>On our calendar today:</strong></p>
                  <p align="center"><?php ssi_recentEvents(); ?></p>
                  <p align="center"><strong>Recently added to the lightboxes:</strong></p>
                  <p align="center"><?php $objCpm->cpm_viewLastAddedMedia(1,3) ?></p></td>


Sorry, I meant cpmfetch code - which is in there.  We don't really do anything with html and stuff here.  At least support wise.



Quote
Now I am not a whizzkid with HTML - I rely a lot on Dreamweaver to build the code for me, but I am slowly starting to learn how to do these things myself. From what I see above, the call to the CpmFetch function is enclosed in a centered <p> tag. This works fine for the SMF SSI calls you see above the final CpmFetch one, but for some reason the table generated by the CpmFetch command is returning content that is aligned to the left. It doesn't look so bad in a 1024x768 screen res, but anything bigger (like what 80% of my users are on) and it looks a bit odd. Would like to have it centered under the output from SMF's SSI stuff, as well as learn how to display perhaps some other detail or formatting.

In the parent defending their child mode:  Cpmfetch is not returning code that is left aligning.  I have cpmfetch return the bare table, HTML spec's are rendering it off to the left.  If you want to change the behavior, you need to pass in codes through the optionarray to set a center on the table, or set CSS and change it through that. 

http://www.fistfullofcode.com/projects/copperminefetch/manual/ch06s02.html

Now that I look, you may only be able to do it through CSS.  I think in the newer releases I have an option to pass through any tags you want to the parts of the table, but I don't see it documented here.


Quote
I used to be a Unisys 2200 mainframe programmer (Mapper) about 15 years ago, so I have a limited understanding of programming in a PC environment. The PHP stuff is great! Really enjoying seeing all the things that are possible and am hoping to continue the learning to the point where I can develop my own applications and start taking my sites to a new level. I can't begin to explain how much closer to understanding the workings of PHP your "add-on" has provided me.

Will wait until your dev version is declared stable before I upgrade (am working with the latest stable version, 1.6.4 - I think?), but thanks for the hint.

Yep, that eagle shot is a pearler! We have some very talented guys (and gals) on Nikongear.

There is a post in here with the beta documentation for the next version - it does a more in-depth job of explaining some of the php involved - put in a way for beginners.  I'd be interested to hear your feedback... 


Have a nice day,

Vuud

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