Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 2 [3] 4

Author Topic: ZenPhoto 1.2 integration with MU  (Read 9948 times)

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
Re: ZenPhoto 1.2 integration with MU
« Reply #30 on: August 25, 2010, 06:53:53 PM »

*Update*
I just checked my zp_comments table and there is a message in php myadmin :

PRIMARY      PRIMARY      0       Edit         id
imageid            INDEX    None      Edit     imageid
imageid_2    INDEX    None      Edit     imageid 

The following indexes appear to be equal and one of them should be removed: imageid, imageid_2

What do you do to get the above message in phpMyAdmin?
What version of ZenPhoto are you using?
Maybe the table is different in yours than in my 1.2.2 version - my comments table has the following fields:
   id, ownerid,  name, email, website, date, comment, inmoderation, type, IP, private, anon
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

alks

  • Jr. Member
  • **
  • Karma: 0
  • Posts: 53
Re: ZenPhoto 1.2 integration with MU
« Reply #31 on: August 25, 2010, 07:20:13 PM »

I'm using 1.1.4 (not far behind yours)

i have the same fields apart from ownerid, private & anon.

I'm not sure why i'm getting tthat mesage in phpmyadmin but its there - its just a warning i think. Probably not the issue as your getting the same issues with comments as me. (btw i get this message when i click on the zp_gallery table - it just shows it below the table - it just has a triangluar warning sign with the message to the right)

MMmm
« Last Edit: August 25, 2010, 08:31:35 PM by alks »
Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
Re: ZenPhoto 1.2 integration with MU
« Reply #32 on: August 25, 2010, 10:58:54 PM »

OBSERVATION:

When mousing over the button to Submit the comment, the URL in the browser (lower left corner) shows only as: #
It should show something like: ?action=savecomment in the same way mousing over a SAVE button in the Admin area shows: ?action=saveoptions
We need to find the code that generates the Comment form... and see what "action" the button links to.

UPDATE......
The comment form is generated within each theme's image.php file.
This is the string that generates the submit action as #
        <form id="commentform" action="#" method="post">

In zp-core/admin-comments.php, the form action used to save an admin-edited comment is (as suspected) ?action=savecomment. I tried replacing the # in the image.php file but this made no difference... still didn't submit any data to the zp_comments table.

TESTING:
-  Inserted a first comment into the zp_comments table manually via phpmyadmin.
-  Edited the comment from the admin panel - the Edit gets saved to the table OK.
   So, we know <form id="commentform" action="?action=savecomment" method="post"> (used by comment edit) saves to the table.

The next question to answer is, why does it not also work in the comment form itself?
Also, I don't see how a comment gets tied to an image (it would need to be referenced to the image id and albumid) so that it would display along with the image to which it was posted.
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

alks

  • Jr. Member
  • **
  • Karma: 0
  • Posts: 53
Re: ZenPhoto 1.2 integration with MU
« Reply #33 on: August 26, 2010, 12:09:05 AM »

Yes this is interesting, i have looked at the comment form in image.php and since it works perfectly with other themes (if you change the theme to default for example) it must be a conflict with the snews file that has been inlcuded somehow - but what i dont know. I had ealier changed some of the function names in snews.php to see if that made any change i did get the error message to change but of course the data did not get put in the database comments table. As far as i see it there can only be 2 reasons for this 1) there is a coflict with a function or 2) there is a conflict with a variable.
Zen gallery is not easy to find the bits of code in question so this is taking some time.

I am getting the same # as you are when i submit the comment so this does look like its the issue but ive no idea how to find the culprit.

alks

 
Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
Re: ZenPhoto 1.2 integration with MU
« Reply #34 on: August 26, 2010, 04:28:39 PM »

As far as i see it there can only be 2 reasons for this 1) there is a coflict with a function or 2) there is a conflict with a variable.

DISABLING the first string in function title(); in the snews.php file - echo '<base href="'.db('website').'" />'; solves the problem - Z-P ccomments go through OK.

Tried replacing the db-variable in the string with the actual URL but it doesn't work.

Next Questions...why? And what's the solution?
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

alks

  • Jr. Member
  • **
  • Karma: 0
  • Posts: 53
Re: ZenPhoto 1.2 integration with MU
« Reply #35 on: August 26, 2010, 05:02:02 PM »


DISABLING the first string in function title(); in the snews.php file - echo '<base href="'.db('website').'" />'; solves the problem - Z-P ccomments go through OK.

Tried replacing the db-variable in the string with the actual URL but it doesn't work.

Next Questions...why? And what's the solution?


i had a look at the title() function after you posted and noticed the comments were going through also when the function was disabled - but before that i was playing with the title function in the image.php file and also got it to post a comment but i cant re-create what i did (yet) - however on that occasion it was posting a comment but still showing the snews error message afterwards. Mmm

i havel also noticed that allthough i now have some comments in the database they are not actually being shown under the image in the gallery (like with the default theme)
 ???

edit :

Right i'm thinking that its base ref from snews thats effecting zenphoto somehow?
« Last Edit: August 26, 2010, 06:36:59 PM by alks »
Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
Re: ZenPhoto 1.2 integration with MU
« Reply #36 on: August 26, 2010, 09:17:13 PM »

It appears that I've found a configuration that works for me.

The base-tag is needed only for sNews alone, not ZenPhoto.
Moving out of the title() function and into the sNews index.php applies it only to sNews and eliminates the conflict with the Z-P theme files.

Give this configuration a test-run on your system. If it works OK for you too, then I should update the Download package.

1.  In the snews.php, take a copy of the base-tag string within the title(); function, then disable (or remove) it:
          echo '<base href="'.db('website').'" />';

2.  In the snews index.php file, paste the base-tag in just before title(); so the string looks like this:
          <?php echo '<base href="'.db('website').'" />'; title(); ?>
    This makes the tag available for sNews as if it was still in the title(); function.

Now we'll make some minor tweaks in the three key files in the Zen Photo theme:
        themes/snews/index.php    themes/snews/album.php   themes/snews/image.php
These changes would apply to any Z-P theme ported to have snews functions running in it.

1. In all files, we keep the <?php title(); ?> function-tag in the <head>
   since the function no longer conflicts with the base-tag string removed from it.

1. In themes/snews/index.php, 4 lines down from the title(); tag string, add:  ../
     to the path to style.css so it looks like this:
          <link rel="stylesheet" type="text/css" href="../style.css" media="screen" />
    This keeps the sNews root/style.css declarations applying in the Gallery's home page.
    ... and completely remove the <?php module_css_links(); ?> string below it.
       That function (in snews.php)  isn't required in this file since it only applies to sNews-specific modules.

2.  In themes/snews/album.php, we make the same changes as we did in step 1 (above), and for the same reasons,
    only we add: ../../ to the file-path soit looks like this:
          <link rel="stylesheet" type="text/css" href="../../style.css" media="screen" />

3.  In themes/snews/image.php, we make the same changes as we did in step 2 (above), with the file-path as:
          <link rel="stylesheet" type="text/css" href="../../style.css" media="screen" />

Now... I notice the RSS Icon image for the RSS links for sNews articles, Pages and Comments... in the bottom-right corner of the template... are no longer displaying because they are generated with relative paths (in snews.php) and those won't work with no base-tag in Z-P files to complete the full paths to them.
The simplest solution is to remove rss_links(); from the footer section in all three theme files since we really don't need them until we are back on an sNews page again... and they'll be there when we are there.
« Last Edit: August 26, 2010, 09:34:30 PM by Keyrocks »
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

alks

  • Jr. Member
  • **
  • Karma: 0
  • Posts: 53
Re: ZenPhoto 1.2 integration with MU
« Reply #37 on: August 27, 2010, 12:13:56 AM »

Right ok the good news that after a bit of fiddling about i did get this to work on my system :)
This is great keyrocks! its works! Comments can be added and no probs so far!

I did however have to add the "../ " to my header images in themes index.php etc.. as i am using a jquery fader.

What i'm not entirely clear on is why we need to add "../" and "../../" in the css links. It worked before without them (
 for index.php, image.php, album.php) so why do we need them now? Nothing appears to have changed in the directory structure? the only thing that has changed is the fact we put the base ref in the index.php instead of the snews.php file - why would that make a difference? (or am i missing the obvious  :-\)

I will test it some more tommorow with fresh mind,

But for now thanks for your efforts keyrocks moving the base ref to the index.php was a great idea!

thanks,

alks

*mini update* if you select the option to not use the captcha in theme options it causes a fatal error when you goback to the gallery. So to avoid this its best to comment out that option in the themeoptions.php file at around line 30.
« Last Edit: August 27, 2010, 12:35:34 AM by alks »
Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
Re: ZenPhoto 1.2 integration with MU
« Reply #38 on: August 27, 2010, 02:45:35 AM »

I did however have to add the "../ " to my header images in themes index.php etc.. as i am using a jquery fader.

What i'm not entirely clear on is why we need to add "../" and "../../" in the css links. It worked before without them (
 for index.php, image.php, album.php) so why do we need them now? Nothing appears to have changed in the directory structure? the only thing that has changed is the fact we put the base ref in the index.php instead of the snews.php file - why would that make a difference? (or am i missing the obvious  :-\)

I hope this doesn't make it even more confusing....  ;D

In snews title(); , the echo '<base href="'.db('website').'" />'; gets its value from the $db['website'] variable within function db where we configure our database settings at the top of snews.php. In my case, my localhost project directory is 16snews, so the value for this variable is http://localhost/16snews/

Setting the base URL in the <head> of the index.php allows us to use relative rather than absolute (full) paths in all links in all snew functions. In a sense, the base-tag value is like a global value in that it is available system-wide. It sets the base upon which all relative URLs are extended. Together, the base-tag value and the relative URL are recognized as full absolute URLs (necessary to connect) by web browsers.

As an example, let's say we want to create a text link to the admin panel to create a new article.
The absolute link to it (the action in the function that generates it) would normally be - http://localhost/16snews/article_new/ but, since we've already defined the base URL... we only need to write a relative link to get the panel.

In this case, we only need to write the link as echo '<a href="article_new/">New Article</a>'; in a PHP function... and the browser combines it with the base URL to get us there when we click the link. The same applies to file-paths for images and files as well.

The main reason we use the base-tag in sNews and have its value coming through a global variable (as I understand it), is that it makes for shorter code when you have dozens or even hundreds of links in all of the system functions. It allows us to set the URL root (the domain root) in one place only and make all our links with only the relative link part without having to add the variable in every link (shorter code). If we took the base-tag out of the picture altogether, all those relative links throughout all the snews functions would no longer work, and we would have to go back through all the functions and insert a variable into every link - that would have the URL root as its value - so that they would become full absolute links.
« Last Edit: August 27, 2010, 02:50:57 AM by Keyrocks »
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

Fred K

  • Still trying to learn stuff
  • ULTIMATE member
  • ******
  • Karma: 130
  • Posts: 2728
    • Personal
Re: ZenPhoto 1.2 integration with MU
« Reply #39 on: August 27, 2010, 03:13:47 AM »

Quote from: alks
I did however have to add the "../ " to my header images in themes index.php etc.. as i am using a jquery fader.
What i'm not entirely clear on is why we need to add "../" and "../../" in the css links. It worked before without them ...

Just to add to the confusion, as Key's mentioned this has to do with the relocation of the base tag. A quick way of getting around the problem, instead of using the "../" construct, you can use just the "/" construct.
Example (applies to any location):
Code: [Select]
(HTML) <img src="/images/faderpic1.ext" alt="la-la-la" />
(CSS) #ix {background: url(/images/bakgroundpic1.ext) foo bar; }

The single "/" points to the site root, then you just add the necessary levels to get to the correct subfolder for your target item. Thus, no need to count "../" steps relative from the starting point. And as the single "/" always pulls you back to root, it works regardless if you're in the ZP zone or the sNews zone - as long as the root is the same.

@Key's - to even further confuse things, there are a ton of $link bits in snews.php that have this construction: "<a href="'._SITE.'' ...", which is kind of redundant since the base href is in place. If there was no base href in place, that manifold presence of <a href="'._SITE.''-constructed links would make better sense. As it is (in the default snews.php) the $link and similar constructs could just as well be <a href="' et cetera. However, that is just a note in the margin, it doesn't affect the issue at hand.
« Last Edit: August 27, 2010, 03:25:16 AM by Fred K (agentsmith) »
Logged

alks

  • Jr. Member
  • **
  • Karma: 0
  • Posts: 53
Re: ZenPhoto 1.2 integration with MU
« Reply #40 on: August 27, 2010, 01:12:06 PM »

@keyrocks

well thank you for your explanation but i'm still tying my head in knots  :P . I still do not understand why moving the base ref to the index.php file would change anything, If its in the snews file it uses
Code: [Select]
$db['website'] = 'http://localhost/Pangbourne_CMS/';
as its ref so when its in the index.php file it should still do the same so why does that in turn effect the zen photo files? as they are in a folder of their own and the css & image files reside in the same level directory.
I thought we were using relative links anyway or am i just confusing my self needlessly ?

@Fred K

yes using / does map back to the root but its a bit long to type this everytime

/mywebsite/gallery/themes/mywebsitetheme/styles/main.css

but its an option to consider if troubles arise plus its easier to understand how your getting there.

alks
Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
Re: ZenPhoto 1.2 integration with MU
« Reply #41 on: August 27, 2010, 05:02:19 PM »

@Key's - to even further confuse things, there are a ton of $link bits in snews.php that have this construction: "<a href="'._SITE.'' ...", which is kind of redundant since the base href is in place. If there was no base href in place, that manifold presence of <a href="'._SITE.''-constructed links would make better sense. As it is (in the default snews.php) the $link and similar constructs could just as well be <a href="' et cetera. However, that is just a note in the margin, it doesn't affect the issue at hand.

Yes, this is the case in sNews 1.7... at least 52 links are using _SITE and maybe more. Going through the snews.php file in 1.7 and getting all links in the same format would be a project in itself... if left to me I would leave it till winter sets in. I haven't brought ZenPhoto and 1.7 together yet so I don't know if the same problem with the base-tag would exist in it too.

Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

Fred K

  • Still trying to learn stuff
  • ULTIMATE member
  • ******
  • Karma: 130
  • Posts: 2728
    • Personal
Re: ZenPhoto 1.2 integration with MU
« Reply #42 on: August 27, 2010, 10:19:47 PM »

Quote from: alks
yes using / does map back to the root but its a bit long to type this everytime
/mywebsite/gallery/themes/mywebsitetheme/styles/main.css

Point taken, that is a bit excessive in length. Although unless I'm missing something you can leave out the /mywebsite leg, so you'd "only" have to write "/gallery/themes/etc" yourself. Still a bit over-long though. Sorry I can't help more with the _real_ problem.
Logged

Fred K

  • Still trying to learn stuff
  • ULTIMATE member
  • ******
  • Karma: 130
  • Posts: 2728
    • Personal
Re: ZenPhoto 1.2 integration with MU
« Reply #43 on: August 28, 2010, 12:40:37 AM »

Quote from: Keyrocks
in sNews 1.7... at least 52 links are using _SITE

Ho-hum, what were we thinking of ...
Anyway, all you need to do is a quick search-and-destroy of each link using this particular construct and remove the '._SITE bit. You can do it manually - do one a week and you'll be done in a year. 8) Or ... you can let your text editor do it for you and it'll take, what, .52 seconds? Something like that.

Snipp, snapp, snut, så var sagan slut.
(Or to quote the guy in the movie: Here endeth the lesson)
« Last Edit: August 28, 2010, 12:44:56 AM by Fred K (agentsmith) »
Logged

alks

  • Jr. Member
  • **
  • Karma: 0
  • Posts: 53
Re: ZenPhoto 1.2 integration with MU
« Reply #44 on: August 28, 2010, 09:58:35 AM »

A ha, i get it (i think). I was confusing myself needlessly afterall.

Thanks for the help and asssiatnce with this, at least now zen photo seams to work much better than it did.
When i finish my project i will let you see it :) I just have to add a few extra mods - i'm thinking your snews calandar might be a good add on.

To complete your instructions above for the "search.php" page to be styled correctly an extra ../ is required hense it will be
Code: [Select]
<link rel="stylesheet" type="text/css" href="../../../style.css" media="screen" />
alks
« Last Edit: August 28, 2010, 11:54:01 AM by alks »
Logged
Pages: 1 2 [3] 4