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: how to use anycontent.php  (Read 3720 times)

0 Members and 1 Guest are viewing this topic.

brynn

  • Coppermine frequent poster
  • ***
  • Country: us
  • Offline Offline
  • Gender: Female
  • Posts: 198
    • Inkscape Commmunity
how to use anycontent.php
« on: October 15, 2013, 11:32:41 pm »

Hi Friends,
After some research (searching forum and manual) I haven't found very much helpful info about how to use the anycontent.php feature.  So besides getting answers for myself, maybe this topic will help others too.  Perhaps for someone who knows php, it's very clear how to use it.  But for me, not so much.

When you read the manual section for the anycontent.php feature, it says you need to know php to use it.  But in another topic where I made a new feature request for front page content, Andre answered this:

Just add your HTML code to the anycontent.php file. ...

So it sounds like I might be able to use it, since I do know some basic html.  But exactly where to put the html is not clear to me.  The example in the manual, and the actual anycontent.php file are entirely different (except for the <?php at the beginning, and ?> at the end).  So I assume that the example in the manual displays an entirely different page (or section of a page) than the anycontent.php file.  And of course I realize that the default anycontent.php file is not meant to be used as it is.  But just as a user experience comment, it might be helpful if the example in the manual looks something like the actual default anycontent page (i.e. with the copyright, version, and license info included)  ;)  Anyway, since the example in the manual does not use html, I can't really use it as a guide....unless I actually want to display a message to guests, I guess.

In perusing the actual default anycontent.php file, the only recognizable html is between

Code: [Select]
echo <<< EOT
and

Code: [Select]
EOT;
which I assume is where the html code should go, as Andre suggested.  Correct?

And it looks like the entire html content needs to go inside the css "tableb" class' cell (<td>).  Is that correct?  I guess the tableb class is what makes it look like part of the theme?

Could I make several cells (<td>)?  What if I made another row (<tr>)?  Or could I replace everything between the EOTs?  Like for example, could I use a div element instead of tr?  Or could I put an entire table, inside <table> tags?  I guess it is entirely possible to have an entire table inside a <td> element.  So maybe these questions are moot?  I guess if I replace the <tr> tags, I lose the tableb styling, right?

I'm actually not sure exactly how I want to use the anycontent feature.  What I am sure about is that I want to get rid of the Random section.  My first idea is just to display the same 2 or 3 images, all the time.  If my gallery becomes very popular, I may want to use it for a Featured Images or Featured Artist section, which would change periodically.  So far, the gallery hasn't caught on yet, so I'm very limited in what to display there.  But let's start with the idea of having 2 images displayed in this new section (or maybe it's called a block?).

Do I write the html using <img> tags?  What do I put for the URL, to have the thumbnail show up?  If I can make the thumbnail show up, would I need to make the images to be active links to the intermediate page (<a href=url>)?  Or is the thumbnail automatically a link?

Just above the starting EOT it says:

Code: [Select]
starttable("100%", $lang_index_php['welcome']);
Does that mean it displays the word "welcome" in whatever language the user uses?  So for example, where it says "Random files" in the attached image -- is that where "Welcome" will show up, in this new section/block?  If that's the case, then I might want to change it, to something like "Featured images".  Or is 'welcome' just part of the code, and doesn't get displayed?

Thanks for you help and patience with all my newbie-ness  :o
Logged

Niecher

  • LocalSupporter
  • Coppermine frequent poster
  • ***
  • Country: es
  • Offline Offline
  • Gender: Male
  • Posts: 191
Re: how to use anycontent.php
« Reply #1 on: October 16, 2013, 01:13:57 pm »

Hello brynn,

Check out:
http://www.w3schools.com/

Regards.
Logged

brynn

  • Coppermine frequent poster
  • ***
  • Country: us
  • Offline Offline
  • Gender: Female
  • Posts: 198
    • Inkscape Commmunity
Re: how to use anycontent.php
« Reply #2 on: October 16, 2013, 02:51:10 pm »

Thanks Niecher.  Perhaps there is an issue with how you understand my message, because of the translation (from Spanish, I think)?  The problem is not that I don't know how to write html, in general.  The problem is not understanding how CPG/anycontent.php uses html.

The manual says that the admin needs to have an understanding of php, to be able to use anycontent.php.  However, in the quote from Andre, he seems to indicate that it might not be necessary to know how to write php, and that  html can be inserted into the php file.  So that's what I'm investigating.

Hhmmm....rather than trying to re-phrase all my questions, maybe it would be better to wait for someone else to reply?  I'm not sure.  If no one else has answered after a day or 2, I will re-phrase all my questions, and ask them again.

Meanwhile.....well.....based on a LOT of assumptions, maybe I'll take a stab at editing the anycontent.php file.  Then maybe I could specifically illustrate my questions for you.

Thanks again  :)
Logged

brynn

  • Coppermine frequent poster
  • ***
  • Country: us
  • Offline Offline
  • Gender: Female
  • Posts: 198
    • Inkscape Commmunity
Re: how to use anycontent.php
« Reply #3 on: October 16, 2013, 10:58:32 pm »

Ok, I have a very simple, but somewhat successful, anycontent.php file working:  http://inkscapecommunity.com/ic_gallery/index.php

Now to repeat the still unanswered questions.

1 -- The titlebar (for lack of proper teminology) for the anycontent block says "Welcome!".  I thought if I changed

Code: [Select]
starttable("100%", $lang_index_php['welcome']);
to

Code: [Select]
starttable("100%", $lang_index_php['Featured Image']);
it would cause "Featured Image" to appear in the titlebar area.  That didn't work, and instead "Welcome!" just disappeared.  But then I noticed that the anycontent.php file said "welcome", yet "Welcome!" was displayed.  So I thought if I tried changing

Code: [Select]
starttable("100%", $lang_index_php['Featured Image']);
to

Code: [Select]
starttable("100%", $lang_index_php['featured image']);
it might work.  But it didn't  :(  So it seems like I can have either "Welcome!" or nothing -- unless someone can tell me how to display "Featured Image" in that sort of titlebar location? 

So Question #1 -- How can I change the currently displayed  "Welcome!" to whatever I might need?  Also, in the future, I may make this a monthly feature, or a featured artist, or maybe even featured album (if I could figure out how to put an album in the <td> tags)   .  So if there is any way to change it, it would need to be something that I can change as needed.  If that can't be changed, hhmmm....well, maybe I could put the text inside the block, instead of in the titlebar area?

2 -- Centering the image.  I tried a few different ways to center the image in the block.  In the end, I had to use <div align=center> even though, unless I'm misunderstanding what I've read at the W3Schools site, <div align=center> is deprecated code.

I also tried centering using margin property but I couldn't make it work.  I actually was able to center the image by putting it in <th> tags, but that seemed somewhat inappropriate.

But I also read that affecting a layout using tables is not the correct use of the table element (on this page).  At least not anymore.  So perhaps CPG hasn't caught up to the standards yet?  (Note that I don't mean to sound critical.  I'm really fairly well overwhelmed with all of this, and trying hard to understand.)  So perhaps using <div align=center> is the proper way to do it, after all?

So Question #2 -- Is there a better way to center a single image?  Another thing I might like to do, is have 2 featured images shown there.  But I can't seem to sort out how to have 2 images centered.  I couldn't get margin:auto to work, but maybe a % value would work?  Or maybe I could find a way to use div align=center for that too?

And let me be clear.  I realize that you probably don't want to provide support for html code.  But since I could only center the image by using an outdated code, I'm not sure if I can depend on W3Schools to provide what I need for CPG.  On the other hand, there's every chance that I still haven't found the proper way to do it yet. 

So without stepping outside your comfort zone, if you could give me just a hint about these things, I would be very grateful  :)

Thank you very much for whatever help you can offer  :)
Logged

Jeff Bailey

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1322
  • Fishing relaxes me.
    • Bailey Family Co.
Re: how to use anycontent.php
« Reply #4 on: October 17, 2013, 12:19:52 am »

 in lang/english.php
Code: [Select]
// ------------------------------------------------------------------------- //
// File index.php
// ------------------------------------------------------------------------- //
if (defined('INDEX_PHP')){
$lang_index_php['welcome'] = 'Welcome!';
Change the text in the language files, of course this only changes it for the languages you choose to change.

I'm a little fuzzy on what images are you trying to center exactly?

edit: Not sure if you noticed but you have the theme selector enabled.
« Last Edit: October 17, 2013, 12:25:01 am by Jeff Bailey »
Logged
Thinking is the hardest work there is, which is probably the reason why so few engage in it. - Henry Ford

Niecher

  • LocalSupporter
  • Coppermine frequent poster
  • ***
  • Country: es
  • Offline Offline
  • Gender: Male
  • Posts: 191
Re: how to use anycontent.php
« Reply #5 on: October 17, 2013, 01:24:15 pm »

Hello brynn,

To put any title, you can use this:
Code: [Select]
starttable("100%", "Featured Image");

and to put two images and center them without <div>, you can use this:
Code: [Select]
    <tr>
       <td class="tableb" align="center">
         <img src="http://inkscapecommunity.com/ic_gallery/albums/userpics/10009/1.png" alt="featured image" />
         <img src="http://inkscapecommunity.com/ic_gallery/albums/userpics/10009/2.png" alt="featured image" />
       </td>
    </tr>

Regards.
Logged

brynn

  • Coppermine frequent poster
  • ***
  • Country: us
  • Offline Offline
  • Gender: Female
  • Posts: 198
    • Inkscape Commmunity
Re: how to use anycontent.php
« Reply #6 on: October 20, 2013, 12:14:54 am »

Ah-HA!

I thought of td align=center, too, Niecher, but it's also said to be deprecated.  So I thought somehow using div would make it less so, somehow  ::)

Jeff Bailey, there's only 1 image there now.  But I may (probably) want to have 2.  Yes, I enabled the theme selector on purpose.  And I enabled it for all the themes I'm using, so members can switch back and forth, if they like.  :)  (Most members will be artistic, or at least creative, and may be more likely to have particular tastes regarding the theme (than most people).  So that's why I wanted to have a few themes available.)

Regarding changing the "Welcome!" text in the top bar of the anycontent block -- I understand both of your suggestions.  I'm just not sure which one would be best to use.  I do have the gallery set up for a number of different languages, and hope to have some international membership.  So perhaps it would be best to use Jeff Bailey's suggestion?  Although Niecher's suggestion would be much easier, if doing it that way, will allow the text will be translated.

Hhmmm....ok, so when I change the code which Jeff Bailey indicated, for example in spanish.php, I'll have to actually look up the translation of "Featured Images" or "Featured Artist" (or whatever I decide to use) in spanish, to put the proper text in spanish.php file.  Right?  I'm guessing this will be the best way to do it.

Ok, than you both very much!
Logged

phill104

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 4885
    • Windsurf.me
Re: how to use anycontent.php
« Reply #7 on: October 20, 2013, 05:30:26 pm »

If using multi languages please use the option detailed by Jeff.
Logged
It is a mistake to think you can solve any major problems just with potatoes.

brynn

  • Coppermine frequent poster
  • ***
  • Country: us
  • Offline Offline
  • Gender: Female
  • Posts: 198
    • Inkscape Commmunity
Re: how to use anycontent.php
« Reply #8 on: October 22, 2013, 01:16:36 am »

Ok, I gave it my best shot, lol.  Using Bing and Google translators can be an adventure, so I can only wait for feedback from members, if I got it wrong.

For now, my questions are answered.  But I may become more adventurous in the future, with the anycontent block.  So I'll mard solved for now, but may open again in the future.

Thank you very much, to everyone who helped  :)
Logged
Pages: [1]   Go Up
 

Page created in 0.025 seconds with 19 queries.