Can I call a theme with CPMFETCH? Can I call a theme with CPMFETCH?
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Can I call a theme with CPMFETCH?

Started by johnf, April 27, 2007, 09:48:35 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

johnf

Obejctive:  I want visitors who go to my CPGallery from a Wordpress blog to use a different theme from my gallery default (less navigation options) when they visit.  I have modified a copy of the theme I use for the gallery, eliminated the navigation options I don't want and renamed it "wordpaccess".  I made a text link from the blog that works by simply putting the theme name at the end of the URL:
http://www.mydomain.com/GALcpg1410/index.php?theme=wordpaccess

I am using CPMFetch to display latest gallery uploads in a sidebar on the Wordpress blog page.  Since I am absolutely new at all of this, and the CPMFetch docs were much easier to follow than wordpress, I just (maybe a klugy way to do it) put the CPMFetch instructions into a file that I saved as gallery.php and populated an IFrame with that file.  My gallery.php is just a simple modification of your example code and it works fine:

<?php
  include_once "../../../../GALcpg1410/cpmfetch/cpmfetch.php";
  $objCpm = new cpm("../../../../GALcpg1410/cpmfetch/cpmfetch_config.php");
$options = array( "windowtarget" => "_blank" );
// $options = array("subtitle" => "File name : {{pFilename}}");
  $objCpm->cpm_viewLastAddedMedia(4, 1, $options);
  //$objCpm->cpm_viewRandomMediaFrom("cat=1",1, 4, $options);
  $objCpm->cpm_close();
?>

By calling for the gallery.php file inside the IFrame, Wordpress displays exactly what I want in my sidebar.  Since I couldn't figure out how to paste the php into wordpress, I just inserted the following into my sidebar file:

<li id="Recent Additions">
   <h2>Recent Additions</h2>
      <IFRAME src="http://www.mydomain.com/wordp/wp-content/themes/vertigo-enhanced-20/gallery.php" width="150" height="400"
             scrolling="auto" frameborder="0" align="center">
  [Your user agent does not support frames or is currently configured
  not to display frames. However, you may visit
  <A href="http://www.mydomain.com/GALcpg1410/gallery.php">the related document.</A>]
  </IFRAME>

What I've spent most of the last two days trying to do - remember I don't know PHP at all - is try all of the function and option language I can think of in numerous spots to make a click on the (cpmfetch generated) thumbnail link to the gallery using my modified theme.

I keep re-reading the sections in the docs on using the OptionsArray effectively.  Is there something in the linkattributes or linktemplate that I can use to do this? 

I also tried making a second cpmfetch_config where the theme=wordpaccess  and I tried changing the line in gallery.php to reflect that, but it didn't work either:
  $objCpm = new cpm("../../../../GALcpg1410/cpmfetch/cpmfetch_configWP.php");

I also saw the section you reference for overriding defaults but I couldn't guess what the syntax might be or if changing the theme there was even possible.

Any really beginner level suggestions for me?  I just keep thinking that I should be able to drop some kind of HTML or PHP code in one of these two files (gallery.php or in the sidebar IFrame reference) that would do this for me?

I want to be able to use CPMFetch from several of my sites and being able to customize the visitor experience would be great!
Thank you

vuud

Quote from: johnf on April 27, 2007, 09:48:35 PM

What I've spent most of the last two days trying to do - remember I don't know PHP at all - is try all of the function and option language I can think of in numerous spots to make a click on the (cpmfetch generated) thumbnail link to the gallery using my modified theme.

I keep re-reading the sections in the docs on using the OptionsArray effectively.  Is there something in the linkattributes or linktemplate that I can use to do this? 

I also tried making a second cpmfetch_config where the theme=wordpaccess  and I tried changing the line in gallery.php to reflect that, but it didn't work either:
  $objCpm = new cpm("../../../../GALcpg1410/cpmfetch/cpmfetch_configWP.php");

I also saw the section you reference for overriding defaults but I couldn't guess what the syntax might be or if changing the theme there was even possible.

Any really beginner level suggestions for me?  I just keep thinking that I should be able to drop some kind of HTML or PHP code in one of these two files (gallery.php or in the sidebar IFrame reference) that would do this for me?

I want to be able to use CPMFetch from several of my sites and being able to customize the visitor experience would be great!
Thank you

Wow, that is a lot of typing :D

I am not 100% sure what you are asking, but I suspect what you are looking for is the linktemplate option...

Can you paste an example of exactly what your link should look like?  Including the call to the gallery.

Obviously you have tried hard to get this to work... I appreciate that.


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

johnf

OK, not to sound dense, but I'm not sure what you are asking me.  Maybe this (which came from the HTML that was generated by CPMFetch) is part of the answer?

<td><a target="_blank" href="http://www.mydomain.com/GALcpg1410/displayimage.php?pos=-25"  ><img  src="http://www.mydomain.com/GALcpg1410/albums/public/thumb_0096.jpg" alt="0096.jpg" title="0096.jpg"  /></a><br /></td>

and this - which works as a text link...is another part?

http://www.mydomain.com/GALcpg1410/index.php?theme=wordpaccess"

I'm sure it's a pain to be asked for such basic help, but I really appreciate it.

vuud

Quote from: johnf on April 27, 2007, 10:10:30 PM
OK, not to sound dense, but I'm not sure what you are asking me.  Maybe this (which came from the HTML that was generated by CPMFetch) is part of the answer?

<td><a target="_blank" href="http://www.mydomain.com/GALcpg1410/displayimage.php?pos=-25"  ><img  src="http://www.mydomain.com/GALcpg1410/albums/public/thumb_0096.jpg" alt="0096.jpg" title="0096.jpg"  /></a><br /></td>

and this - which works as a text link...is another part?

http://www.mydomain.com/GALcpg1410/index.php?theme=wordpaccess"

I'm sure it's a pain to be asked for such basic help, but I really appreciate it.



You just want any image you click to the link above?  Not to a specific image or anything?


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

johnf

1.  This link gets me to the coppermine gallery using the right theme:

http://www.mydomain.com/GALcpg1410/index.php?theme=wordpaccess

2.  This is a link that gets me to one of the recently added images that CPMFetch fetched:

<a target="_blank" href="http://www.mydomain.com/GALcpg1410/displayimage.php?pos=-25"  ><img  src="http://www.mydomain.com/GALcpg1410/albums/public/thumb_0096.jpg" alt="0096.jpg" title="0096.jpg"  /></a><br />

What I'm trying to figure out is where to put the "theme=wordpaccess" part of the code in my gallery.php file - or maybe even if it can be put there.  I want to apply this to all of the images that CPMFetch is fetching from gallery.php

FYI Another klugy little thing that seems to work is - if I put an "invisible" (1px by 1px) Iframe above the one that CPMFetch populates with this inside:

<p><iframe align="center" src="http://www.mydomain.com/GALcpg1410/index.php?theme=wordpaccess" frameborder="0" width="1" height="1">
</body></html></iframe></p>

It seems to "tell" the Wordpress page what theme I want to use??Maybe??
Thank you for your patience...I hope that I have answered your question this time.

johnf

Have I actually given you the information you asked for?  I feel really dense since I don't even know how to answer your question about the exact path.  Is there something else I need to tell you?

vuud

Quote from: johnf on April 27, 2007, 11:03:23 PM
Have I actually given you the information you asked for?  I feel really dense since I don't even know how to answer your question about the exact path.  Is there something else I need to tell you?

I don't know - the link does not work, so I am not sure what its supposed to do!

And actually I am not sure I do understand...

Anyway, if you can actually provide real links, it would help me visually see.

If you can show what you are talking about and how exactly it should differ it would help me help you.



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

johnf

This is not a live site, but just a bunch of placeholder tests, but I think you can tell what we are going for on the links if you go here.
Wordpress test page is:
http://www.backgroundlibrary.com/wordp/

See the right column labeled Recent Additions.  This is an IFrame populated by gallery.php which was output by CPMFetch.  When a thumbnail image is clicked, a new window opens (to the larger image in coppermine) using the default (IGames) theme.  Notice that there are actually 2 nav bars listed on the gallery page when you arrive at coppermine.

What I want it to do is open the window to coppermine using my modified (no nav bar) theme called "wordpaccess". 

If you go to the gallery using this link you will see that the nav bars are gone:
http://www.backgroundlibrary.com/GALcpg1410/index.php?theme=wordpaccess

This is the theme I want visitors from the wordpress page to use.  What we want to do is have visitors who go to the gallery from the wordpress page never see the coppermine navigation bar.  But I want to leave IGames as the default for anyone visiting from somewhere else.

I previously sent you the content from gallery.php (my CPMFetch code) and from the IFrame.  What I would like to know is...
where can I put code that will "call" this modified theme when linking from the wordpress page?  if it can be done, what would the code be?

Thank you so much for your assistance.

vuud

Quote from: johnf on April 28, 2007, 07:08:05 AM
This is not a live site, but just a bunch of placeholder tests, but I think you can tell what we are going for on the links if you go here.
Wordpress test page is:
http://www.backgroundlibrary.com/wordp/

See the right column labeled Recent Additions.  This is an IFrame populated by gallery.php which was output by CPMFetch.  When a thumbnail image is clicked, a new window opens (to the larger image in coppermine) using the default (IGames) theme.  Notice that there are actually 2 nav bars listed on the gallery page when you arrive at coppermine.

What I want it to do is open the window to coppermine using my modified (no nav bar) theme called "wordpaccess". 

If you go to the gallery using this link you will see that the nav bars are gone:
http://www.backgroundlibrary.com/GALcpg1410/index.php?theme=wordpaccess

This is the theme I want visitors from the wordpress page to use.  What we want to do is have visitors who go to the gallery from the wordpress page never see the coppermine navigation bar.  But I want to leave IGames as the default for anyone visiting from somewhere else.

I previously sent you the content from gallery.php (my CPMFetch code) and from the IFrame.  What I would like to know is...
where can I put code that will "call" this modified theme when linking from the wordpress page?  if it can be done, what would the code be?

Thank you so much for your assistance.

I think you want linktemplate ...

Its part of the options

You can set whatever you want in there...

I would first make sure you can hand code a link that works with the theme the way you want it (as you want the link to be from a displayed image).

Then, put it into the linktemplate





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

johnf

Vuud,
Thank you for your reply.  I see in your docs about linktemplate:

"With the linktemplate option, you can tell CpmFetch what to use for a link. So if you set this:
http://www.fistfullofcode.com/cpg/ratepic.php?pic={{pPid}}&#038;rate=5"
CpmFetch will automagically insert the picture ID for each one.  See the format tag explaination for more information on what tags are available.  I looked at the format tag documentation, but I didn't see anything that looked like it had anything to do with the theme.

When you said it is "part of the options" can you please give me an example?  (I know it is not your job to teach me PHP, and I am trying my best to read the PHP tutorials and get some understanding of this, but I am a novice.)  Can you just show me what a valid linktemplate option statement might look like?

This hardcoded link you said I need first that works to deliver the template I want is:
http://www.backgroundlibrary.com/GALcpg1410/index.php?theme=wordpaccess

So are you saying that I need to add a line like this somewhere in the code below?
$options = array( "theme" => "wordpaccess" ); 
Does it look something like the commented out subtitle option below?
Or does the term linktemplate actually go in here somewhere?  I tried inserting the theme/wordpaccess version with the options for windowtarget/blank but no luck.

<?php
  include_once "../../../../GALcpg1410/cpmfetch/cpmfetch.php";
  $objCpm = new cpm("../../../../GALcpg1410/cpmfetch/cpmfetch_config.php");
$options = array( "windowtarget" => "_blank" );
// $options = array("subtitle" => "File name : {{pFilename}}");
  $objCpm->cpm_viewLastAddedMedia(4, 1, $options);
  $objCpm->cpm_close();
?>

Thank you so much for your help so far.  Any pointers about specifically what wording and where to place the option will really be appreciated.

vuud

Quote from: johnf on May 01, 2007, 07:03:23 AM
Vuud,
Thank you for your reply.  I see in your docs about linktemplate:

"With the linktemplate option, you can tell CpmFetch what to use for a link. So if you set this:
http://www.fistfullofcode.com/cpg/ratepic.php?pic={{pPid}}&#038;rate=5"
CpmFetch will automagically insert the picture ID for each one.  See the format tag explaination for more information on what tags are available.  I looked at the format tag documentation, but I didn't see anything that looked like it had anything to do with the theme.

The format tag has nothing specifically about the linktemplate, but it does have a nice list of tags you can stick in {{pPid}} etc.


Quote
When you said it is "part of the options" can you please give me an example?  (I know it is not your job to teach me PHP, and I am trying my best to read the PHP tutorials and get some understanding of this, but I am a novice.)  Can you just show me what a valid linktemplate option statement might look like?

This hardcoded link you said I need first that works to deliver the template I want is:
http://www.backgroundlibrary.com/GALcpg1410/index.php?theme=wordpaccess

So are you saying that I need to add a line like this somewhere in the code below?
$options = array( "theme" => "wordpaccess" ); 
Does it look something like the commented out subtitle option below?
Or does the term linktemplate actually go in here somewhere?  I tried inserting the theme/wordpaccess version with the options for windowtarget/blank but no luck.

<?php
  include_once "../../../../GALcpg1410/cpmfetch/cpmfetch.php";
  $objCpm = new cpm("../../../../GALcpg1410/cpmfetch/cpmfetch_config.php");
$options = array( "windowtarget" => "_blank" );
// $options = array("subtitle" => "File name : {{pFilename}}");
  $objCpm->cpm_viewLastAddedMedia(4, 1, $options);
  $objCpm->cpm_close();
?>

Thank you so much for your help so far.  Any pointers about specifically what wording and where to place the option will really be appreciated.

This will do what you are asking for.


<?php
include_once "../../../../GALcpg1410/cpmfetch/cpmfetch.php";
$objCpm = new cpm("../../../../GALcpg1410/cpmfetch/cpmfetch_config.php");
$options = array( "windowtarget" => "_blank" ,
"linktemplate" => "http://www.backgroundlibrary.com/GALcpg1410/index.php?theme=wordpaccess");
 
$objCpm->cpm_viewLastAddedMedia(41$options);
 
$objCpm->cpm_close(); 
?>






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

johnf

Hello Vuud and thanks again for the assist.  The code you suggested does call the specific theme, but it seems to "override(?)" the link that CPMFetch generated.  It just takes me to the homepage of my coppermine gallery.  Right now it seems that I can either use the link that CPMFetch generates without the theme, or I can get the theme but lose the specific link information.

CPMFetch is displaying thumbnails of the last added images in the gallery.  I want visitors to click on the individual thumbnail generated and see the intermediate size of that specific image in a new window using the wordpaccess theme.

For example - a click on the current thumbnail 1 using the linktemplate code added to gallery.php goes to the home page of coppermine gallery instead of linking to the intermediate image of the thumbnail:
http://www.backgroundlibrary.com/GALcpg1410/index.php?theme=wordpaccess
I can see why this is happening when I look in the html generated for it by gallery.php:
<td><a target="_blank" href="http://www.backgroundlibrary.com/GALcpg1410/index.php?theme=wordpaccess"  ><img  src="http://www.backgroundlibrary.com/GALcpg1410/albums/Paid%20Members%20Premium/thumb_0010.jpg" alt="0010.jpg" title="0010.jpg"  /></a><br /></td>

Without the linktemplate code in gallery.php, a click on this same thumbnail goes directly to the intermediate size image (which is what I want), but the theme displayed is usually Igames, not wordpaccess.  (It seems to depend on the cookie in your browser). This is the URL it goes to:
http://www.backgroundlibrary.com/GALcpg1410/displayimage.php?pos=-103
This is the html generated by gallery.php:
<td><a target="_blank" href="http://www.backgroundlibrary.com/GALcpg1410/displayimage.php?pos=-103"  ><img  src="http://www.backgroundlibrary.com/GALcpg1410/albums/Paid%20Members%20Premium/thumb_0010.jpg" alt="0010.jpg" title="0010.jpg"  /></a><br /></td>

Since it seems that the position is what changes for each thumbnail in the html generated by CPMFetch, is there something I can insert that allows the link to find the theme, but doesn't redirect the image link to the home page?  I've tried substituting displayimage.php along with other source info (album, cat, etc.) but no luck.

I see in your format tags doc that there are tags called "apos" and "cpos" (could those have something to do with this problem I'm having)?

-------------------------------I hope this isn't considered 2 questions, but since I described this option for the problem in a previous post on this topic, here goes-----------------------

If you don't think I can get there from here using linktemplate, is there a possible solution with multiple config files?  As I mentioned in earlier posts, I did try using the instructions from your docs:
When you start CpmFetch and you want to use this other file, you simply pass that as the cpm call parameter. For example, lets say you named it cpmfetch_site1config.php. In this case, your startup code would look like this.

<?php
  include_once "./cpg/cpmfetch/cpmfetch.php";
  $objCpm = new cpm("./cpg/cpmfetch/cpmfetch_site1config.php");
?>

I made a second cpmfetch_config where the theme=wordpaccess  and I tried changing the line in my gallery.php to reflect that, but it didn't work either:
  $objCpm = new cpm("../../../../GALcpg1410/cpmfetch/cpmfetch_configWP.php");

If it is possible to do this with a second config file, I'm guessing that I didn't make the right changes to the file.  I saw the section in help where you reference overriding defaults,  but I couldn't guess what the syntax might be or if changing the theme in that section was even possible. 
Is this a direction I should go?  If so, can you tell me specifically what line to change in the second cpmfetch_config file?

Thank you again for helping me track this down.

vuud

Quote from: johnf on May 04, 2007, 07:04:10 PM
Hello Vuud and thanks again for the assist.  The code you suggested does call the specific theme, but it seems to "override(?)" the link that CPMFetch generated.  It just takes me to the homepage of my coppermine gallery.  Right now it seems that I can either use the link that CPMFetch generates without the theme, or I can get the theme but lose the specific link information.

CPMFetch is displaying thumbnails of the last added images in the gallery.  I want visitors to click on the individual thumbnail generated and see the intermediate size of that specific image in a new window using the wordpaccess theme.

For example - a click on the current thumbnail 1 using the linktemplate code added to gallery.php goes to the home page of coppermine gallery instead of linking to the intermediate image of the thumbnail:
http://www.backgroundlibrary.com/GALcpg1410/index.php?theme=wordpaccess
I can see why this is happening when I look in the html generated for it by gallery.php:
<td><a target="_blank" href="http://www.backgroundlibrary.com/GALcpg1410/index.php?theme=wordpaccess"  ><img  src="http://www.backgroundlibrary.com/GALcpg1410/albums/Paid%20Members%20Premium/thumb_0010.jpg" alt="0010.jpg" title="0010.jpg"  /></a><br /></td>

Without the linktemplate code in gallery.php, a click on this same thumbnail goes directly to the intermediate size image (which is what I want), but the theme displayed is usually Igames, not wordpaccess.  (It seems to depend on the cookie in your browser). This is the URL it goes to:
http://www.backgroundlibrary.com/GALcpg1410/displayimage.php?pos=-103
This is the html generated by gallery.php:
<td><a target="_blank" href="http://www.backgroundlibrary.com/GALcpg1410/displayimage.php?pos=-103"  ><img  src="http://www.backgroundlibrary.com/GALcpg1410/albums/Paid%20Members%20Premium/thumb_0010.jpg" alt="0010.jpg" title="0010.jpg"  /></a><br /></td>

Since it seems that the position is what changes for each thumbnail in the html generated by CPMFetch, is there something I can insert that allows the link to find the theme, but doesn't redirect the image link to the home page?  I've tried substituting displayimage.php along with other source info (album, cat, etc.) but no luck.

I see in your format tags doc that there are tags called "apos" and "cpos" (could those have something to do with this problem I'm having)?

-------------------------------I hope this isn't considered 2 questions, but since I described this option for the problem in a previous post on this topic, here goes-----------------------

If you don't think I can get there from here using linktemplate, is there a possible solution with multiple config files?  As I mentioned in earlier posts, I did try using the instructions from your docs:
When you start CpmFetch and you want to use this other file, you simply pass that as the cpm call parameter. For example, lets say you named it cpmfetch_site1config.php. In this case, your startup code would look like this.

<?php
  include_once "./cpg/cpmfetch/cpmfetch.php";
  $objCpm = new cpm("./cpg/cpmfetch/cpmfetch_site1config.php");
?>

I made a second cpmfetch_config where the theme=wordpaccess  and I tried changing the line in my gallery.php to reflect that, but it didn't work either:
  $objCpm = new cpm("../../../../GALcpg1410/cpmfetch/cpmfetch_configWP.php");

If it is possible to do this with a second config file, I'm guessing that I didn't make the right changes to the file.  I saw the section in help where you reference overriding defaults,  but I couldn't guess what the syntax might be or if changing the theme in that section was even possible. 
Is this a direction I should go?  If so, can you tell me specifically what line to change in the second cpmfetch_config file?

Thank you again for helping me track this down.

Yes, the linktemplate does exactly what you asked for. 

http://www.backgroundlibrary.com/GALcpg1410/index.php?theme=wordpaccess

If you want it to do something different, just change it...

My suggestion is to figure out what the link would be to go to an album just by playing with handcoding it.  Then put it in there.  Or take out the linktemplate, see what cpmfetch generates and if it links okay, then copy it and add the theme= to the end of it.





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