1 squidmaster Sep 05, 2006 01:01
3 balupton Sep 07, 2006 22:16
Can you update to 1.8.1 and then we can help you out (most of our minds don't go back that far ;))
4 squidmaster Sep 07, 2006 22:43
It is 1.8.1. Did I say 1.8? I just got the newest build, which was of course 1.8.1, so we're good.
5 balupton Sep 07, 2006 22:46
Ahh ok, well from reading your post i thought you were still using 0.9 thinking of updating to 1.8. So which problems are still relevant?
6 squidmaster Sep 07, 2006 23:17
Potentially all of them. I have slogged my way through a few areas, but I have had to edit things like plugins and feedback files. I wish I could avoid that with parameters that go just in _main.php, but I doubt that's possible.
I think the confusion here is with the way I phrased my initial post. See, I created a working xhtml and css file based on a page I lifted from my friend's 0.9.whatever installation. Then she upgraded, and now I got her to upgrade again to the latest version. It appears that the xhtml code didn't change much from my workings thus far, which is a relief.
I am also frustrated by the upgrade process a bit. I got my friend to do the upgrade, and it erased all of her custom sidebar content. Fortunately she had saved it and was able to replace, but still hasn't fixed some images on the sidebar. In addition, she can't find a way to backup her posts. That seems like an enormous oversite if it is indeed missing from the blog software. If it's not, I'd love to know what to save so that I could lift her content without taking the whole database.
I think my latest problem (didn't work on it yesterday) is still with the "previous post/next post" content. I want that in a list with a custom class for each list item, but that may be beyond my reach.
7 balupton Sep 07, 2006 23:32
Ok the prev/next post links can be done easily by just changing posts_per_page to 1 instead of 5 or whatever it is. I think this is changeable from the backoffice if not it's somewhere... maybe /conf/_advanced.php by memory...
For converting skins;
http://manual.b2evolution.net/Upgrade_evoskins
It seems to answer everyones queries so far...
And the upgrade problems you should report in the bugs forum, as they really should not be happening.
Which sidebar content was erased?... Are we talking about the linkblog?
8 squidmaster Sep 07, 2006 23:58
No, I'm not having a problem with the previous/next thing actually functioning. I just want it to display differently in the xhtml, and I'd like to be able to keep the words in non-link form when there is no previous or next to go to.
If I changed the posts from 5 to 1, that would change a lot more than I want to change. I showed the html I want a few posts up if that would help with the concept.
Other links of note:
My friend's site as it stands unedited:
http://www.anonymousopinion.com/index.php?blog=1
My template design (just an xhtml page with css)
http://themosmillers.org/Andy/temp/anonymousopinion/test.html
See how I have the previous/next displaying in two places on that page? I might be reaching, but I'd really like to maintain this look if possible.
Oh, and content that was erased was everything on the sidebar below the "login" section. It's all custom content. The problem is that updating always erases custom content. Is there a way to code that content in the system so that an upgrade doesn't ruin the personalized page?
This problem extends to skins too to be sure. So far I have edited _main.php a fair bit, and have also had to edit categories.php and feedback.php. I believe I will have to do that again for this "previous/next" thing if it is even possible to find that code.
9 balupton Sep 08, 2006 00:24
Heres the post_nav_link function:
/**
* Links to previous/next page
*
* Note: remove this tag from skin template if you don't want this functionality
*
* @todo move to ItemList
*/
function posts_nav_link($sep=' :: ', $prelabel='#', $nxtlabel='#', $page='')
{
global $p, $Settings, $MainList;
if( !empty( $MainList->sql ) && empty($p) )
{
$max_paged = $MainList->total_pages;
if( $max_paged > 1 )
{
previous_posts_link( $prelabel, $page );
echo htmlspecialchars($sep);
next_posts_link( $nxtlabel, $max_paged, $page );
}
}
}
Relating to the lost info, has there been any manual database changes? Are the links generated from blog or database? As b2evo does not modify any of the files in the skins directory... So it must be a database thing...
10 squidmaster Sep 08, 2006 00:40
She made the edits to her _main.php file, and that got overwritten with the upgrade. This seems like a weird way to add her extra content, but I don't know of a better one due to lack of experience.
Now to the code:
If I change that function to this:
/**
* Links to previous/next page
*
* Note: remove this tag from skin template if you don't want this functionality
*
* @todo move to ItemList
*/
function posts_nav_link($sep=' :: ', $prelabel='#', $nxtlabel='#', $page='')
{
global $p, $Settings, $MainList;
if( !empty( $MainList->sql ) && empty($p) )
{
$max_paged = $MainList->total_pages;
if( $max_paged > 1 )
{
<li class="previous-post">
previous_posts_link( $prelabel, $page );
</li>
// echo htmlspecialchars($sep);
<li class="next-post">
next_posts_link( $nxtlabel, $max_paged, $page );
</li>
}
}
}
... and add the <ul> stuff in the _main.php, would that fly? Where do I find this file anyway?
... and is there a way to add something to keep the text in place when the links do not exist?
11 balupton Sep 08, 2006 00:50
You should not hack up the original function. But just call it my_[function_name] and stick it in your /skin/_main.php file.
But in this case i don't think you really need to edit the function at all;
posts_nav_link('','<li class="previous-post">Previous Post</li>','<li class="next-post">Next Post</li>');
But then you it will not display the links if they do not exist.
For that though, i would recomend modding the;
previous_posts_link, and next_posts_link functions inside /blogs/inc/MODEL/items/_item.funcs.php with something like;
if( empty($p) && ($paged > 1) )
{
//whatever is there
} else {
echo previous_posts( $page );
}
Hopefully you get the idea :)
12 john Sep 08, 2006 01:20
Try this... in /blogs/inc/MODEL/items/_item.funcs.php find and edit the a href's at the bottom of each...
/**
* Display a link to next page of posts
*
* Note: remove this tag from skin template if you don't want this functionality
*
* @todo move to ItemList
*/
function next_posts_link($label='#', $max_page=0, $page='')
{
global $p, $paged, $result, $Settings, $MainList, $Blog, $Item;
if( $label == '#' ) $label = T_('Next Page').' >>';
if (!$max_page) $max_page = $MainList->get_max_paged();
if (!$paged) $paged = 1;
$nextpage = intval($paged) + 1;
if (empty($p) && (empty($paged) || $nextpage <= $max_page))
{
/*
// fplanque>> this code was supposed to make this work on multiple domains, but it breaks stub files !
// blueyed>> it looks like using $Blog->get('url') should do it.
$siteurl = $Blog->get( 'siteurl', 'raw');
if ( !empty( $siteurl ) )
{
$parsed_url = parse_url( $Blog->get( 'siteurl', 'raw' ) );
$page = $parsed_url['scheme'] . '://' .
$parsed_url['host'] .
$parsed_url['path'];
}
*/
echo '<li><a href="';
echo next_posts($max_page, $page);
echo '">'. htmlspecialchars($label) .'</a></li>';
}
}
/**
* Display a link to previous page of posts
*
* Note: remove this tag from skin template if you don't want this functionality
*
* @todo move to ItemList
*/
function previous_posts_link($label='#', $page='')
{
global $Settings, $p, $paged, $Blog;
if( $label == '#' ) $label = '<< '.T_('Previous Page');
if( empty($p) && ($paged > 1) )
{
/*
// fplanque>> this code was supposed to make this work on multiple domains, but it breaks stub files !
// blueyed>> it looks like using $Blog->get('url') should do it.
$siteurl = $Blog->get( 'siteurl', 'raw');
if ( !empty( $siteurl ) )
{
$parsed_url = parse_url( $Blog->get( 'siteurl', 'raw' ) );
$page = $parsed_url['scheme'] . '://' .
$parsed_url['host'] .
$parsed_url['path'];
}
*/
echo '<li><a href="';
echo previous_posts( $page );
echo '">'.htmlspecialchars($label).'</a></li>';
}
}
and in your _main.php simply wrap the previous next inside ul's like...
<ul>
<?php posts_nav_link(); ?>
<?php
// previous_post( '<p class="center">%</p>' );
// next_post( '<p class="center">%</p>' );
?></ul>
and style them to suit.
13 squidmaster Sep 08, 2006 03:29
Cool. So I also remove the $max_page from:
echo next_posts($max_page, $page);
?
What will this do? The rest was clear enough. My worry is that removing this will create the link even when no next page exists. Clicking that link does what? I'm ok with it staying a link if it's a dead link or (as mentioned) just text in that instance.
14 balupton Sep 08, 2006 03:32
If you can follow my instructions it will do what you want;
put the links in the list, and not use a link if empty.
15 squidmaster Sep 08, 2006 03:51
I sort of understand what you're saying, but not entirely. One thing that is confusing me is that you left out the <a> tags between the <li>'s, which maybe is on purpose but perhaps just an oversight.
I get the gist of the second edit as well, but the gist isn't quite enough for me to modify it confidently. Is the:
//whatever is there
... referring to code, or something that I need to modify with the unlinked text? This part is getting me for sure, but I love the idea.
... and I thank both of you guys for helping out. I'm trying to get this done in time for a September 11th memorial, and I doubt I'd even have a chance without your help.
16 balupton Sep 08, 2006 04:02
Ok so;
echo '<ul>';
posts_nav_link('','<li class="previous-post">Previous Post</li>','<li class="next-post">Next Post</li>');
echo '</ul>';
Is good as we do not need to modify post_nav_link to do what you want.
And;
if( empty($p) && ($paged > 1) )
{
//whatever is there
} else {
echo previous_posts( $page );
}
Really means; Add the following to right after the if statement in previous_posts_links;
else {
echo previous_posts( $page );
}
And the following to next_posts_links
else {
echo next_posts( $page );
}
So // whatever is there, is reffering to whatever code is there originally, saves me from doing a 'find this and replace with this', as i do not need to know the code you need to find.
Now the modifications to the previous_posts_links and next_posts_links are ok, as they do cause any compatability problems, where as, hardcording the <li> elements in would (e.g. with other skins).
So yeh, i do not have a copy of the file in question but the above should be enough for you to figure it out.
17 squidmaster Sep 08, 2006 04:19
Gotcha.
Part of my problem doing this work is that I am not sure what parameters get passed around, and when I find help, that help is not always helpful to a non-php programmer like me. I don't have a clear understanding of how parameters get passed in php either it seems. For instance, sometimes 3 things get passed, sometimes none, sometimes a random amount in a different order, and it can work each way. That is sort of alien to me at the moment.
In the "else" echo command, could I just print a set line that would include a plain old top of page link or something instead of repeating the function with different parameters?
I was trying to tinker with my html/css to get it to work with a <span> instead of an <a> when no <a> was needed, but it's not gelling for some reason.
- another edit -
Also, wouldn't the parameters being passed here put the <li> tags inside the <a>'s? That won't work if it is the case.
18 balupton Sep 08, 2006 06:01
[echo]Part of my problem doing this work is that I am not sure what parameters get passed around, and when I find help, that help is not always helpful to a non-php programmer like me. I don't have a clear understanding of how parameters get passed in php either it seems. For instance, sometimes 3 things get passed, sometimes none, sometimes a random amount in a different order, and it can work each way. That is sort of alien to me at the moment. [/echo] I like to leave enough work left for the person i'm helping so they can 'struggle' a bit, well enough so they learn a few things along the way. To find out what functions have what params, just use a file text searched (dreamweaver contains one) another is agent-ransack, and just search for the function name auntil you find its definition, or you can use the technical docs if you know what the class name is.
[echo]Also, wouldn't the parameters being passed here put the <li> tags inside the <a>'s? That won't work if it is the case.[/echo] Hrmm... Good point...
Now add a optional four params then to the end of posts_nav_link, so when you call it, it would look like;
posts_nav_link('','Previous Post','Next Post','<li class="previous-post">','</li>','<li class="next-post">','</li>');
And the definition in the function would have;
$before_prevous_link = '', $after_previous_link = '', [same for next link]
Then just have echo $before_previous_link before prevous_posts is called, etc etc.
You can figure it out :D
19 squidmaster Sep 08, 2006 06:50
Ack, I was unclear in my last comment. I didn't mean to imply that you weren't helpful. I was talking about the online manual. I will continue to read the rest of your post now...
-edit-
Ok, I'll try to do this tomorrow. I am sick 100% of the time, so guessing takes me hours, but I'll try it out anyway.
Thanks for your time. I think the next issue is going to be with the comment form. I want to replace a div with a span, but I can't find any echo commands or straight <div>'s or <span>'s in any of the code.
20 squidmaster Sep 08, 2006 07:11
... so in order to allow a function to use the default value, I just pass it an empty '', right? That will work as # or something? What is the difference between an empty string and the # sign?
I also hunted around a ton and couldn't find out with the T_ function accomplished. It seems like a print command sometimes, but other times it appears to add formatting, though I admit I am likely wrong about that.
21 balupton Sep 08, 2006 10:08
Ok so if i have;
function myfunc( $text = '', $before ='', $after = '' )
{
echo $before;
echo $myvar;
echo $after;
}
myfunc(); // outputs nothing aka ''.''.''
myfunc('hello'); // output 'hello', aka ''.'hello'.''
A few functions have their params default to '#' which is where you would be getting confused. This would mean that they either want to output '#' or their is multiple default values for it, depending on other values.
So by adding; before_prevous_link, after_previous_link = '', we are making it backwards compatiable with all other calls, as they are optional params, and will output nothing if they have not been filled (without the need of a if statement).
Ack, I was unclear in my last comment. I didn't mean to imply that you weren't helpful. I was talking about the online manual. I will continue to read the rest of your post now...
Never took it that way ;)
22 squidmaster Sep 08, 2006 22:16
Alright, I am hacking away at this now.
Few things:
Am I supposed to be editing _item.funcs.php to do this? Won't any future update to the blog software erase my changes if I do?
Where do I define my custom function, and do I call other functions from within it, or do I just use it to print within other functions?
Another way of doing this that seems maybe a lot easier would be to create a new version of _item.funcs.php and put it in my skins folder. Would that work, or would I have to then change paths to other functions all over the place?
23 balupton Sep 09, 2006 01:00
Yeh just replace the original one, the issue with modding original functions is that it may have a impact on things that call it, which with the modifications we made it will be ok.
You could go and call your own functions eg. my_func, depends what you want to do.
Your choice.
24 squidmaster Sep 09, 2006 02:23
I was unable to create a function to handle this operation due to my lack of a better understanding of php. There are at least 4 functions in play in this section of the blog, and each has a very different (and arcane) set of variables.
What I have done temporarily is to replace these files completely:
_archives.plugin.php
_categories.plugin.php
_item.funcs.php
_feedback.php (I get the impression this one is designed to be replaced for skins since there is a placeholder version essentially in each skin folder)
I made backups of each and can "fix" things quickly.
So should I just place these (with slightly modified names) in my specific skin folder and call them with the new names? Will that work? Do I have to modify anything else to make it work?
I also could use a fix to the "display_list" function, listed below:
<?php
// Display additional credits (see /conf/_advanced.php):
// If you can add your own credits without removing the defaults, you'll be very cool :))
// Please leave this at the bottom of the page to make sure your blog gets listed on b2evolution.net
display_list( $sponsored_links, T_('Credits').': ', ' ', '|', ' ', ' ' );
?>
This creates lists that don't have leading <li>'s, which results in invalid code and 3 closing </li>'s that do nothing. I'd like to repair it for myself and honestly for anybody who wants valid code, but I don't know where to find this function.
I'm also interested in making the <div class="action_messages"> disappear when not in use. This adds a line break and messes with my layout. I can of course style it to vanish, but then it won't work if it is actually needed.
Thanks again. I'm getting closer at least. (http://blvdpark.org/AOtest/blogs/index.php?blog=2&skin=AO)
25 john Sep 09, 2006 02:46
Re the "credits" list issue...
solution is in this thread
http://forums.b2evolution.net/viewtopic.php?t=8959
26 squidmaster Sep 09, 2006 02:57
Very nice. Now I just get 1 warning and it's an empty <span> that might get used some of the time. I hesitate to remove that one.
I was able to modify the previous and next posts to display just the way I wanted. Instead of printing the contents of the same function, I just put my text in empty anchor tags, like this:
echo '<a>Previous</a>';
This solved the problem of having a confusing or broken link.
Will my function renaming and moving solution work you think? I guess I can try it out now and see what happens.
27 john Sep 09, 2006 03:13
Should be fine. Fly it and see :)
The EMPTY SPAN issue only seems to relate topages where a comments/feedback Form is shown...
28 squidmaster Sep 09, 2006 03:38
... and how do I get the previous and next posts to always display at the bottom of pages that are either multipage or extended posts? As it stands, the list collapses on those pages and looks odd.
Trying the "big rename" now. Wish me luck. B)
29 john Sep 09, 2006 04:08
@Squidmaster
You might want check out http://www.paulbellows.com/getsmart/balance_columns/
A small JS script that matches the height of your menu and content div's if content is shorter than the menu it will extend the content div to match, and visa versa.
30 squidmaster Sep 09, 2006 04:40
Why? Is there a problem with something other than the stuff I've mentioned? I am not seeing any div overflow problems.
31 john Sep 09, 2006 04:52
It's not DIV overflow that I'm talking about.
At http://blvdpark.org/AOtest/blogs/index.php?blog=2&skin=AO
The content div is half the height of the Menu div
When you page down all you have is a left side menu and a lot of Blue background..
Just a suggestion
32 squidmaster Sep 09, 2006 05:12
Oh, I gotcha. That isn't much of an issue really. I designed it so it could handle that, but it will only happen in unusual circumstances anyway, as my friend has a ton of content.
33 squidmaster Sep 09, 2006 05:43
I tried to place renamed versions of the category and archives plugins in both my new skin folder and also in the plugin folder. I also changed two lines within each file, like so:
class categories_plugin_AO extends Plugin
...
var $code = 'evo_Cats_AO';
No luck. They just don't display at all this way.
I could really use a way to make this work, as I would love to not have to edit these files (and _item.funcs.php) directly.
34 john Sep 09, 2006 06:21
Well, will you be managing this site?
If so just keep a folder of all the original folders and files PLUS a folder of Edited Files with some commented text file.
Anytime you upgrade simply do a file compare between updated files and your edited files and your set.
http://winmerge.org/ works a treat.
35 squidmaster Sep 09, 2006 06:48
No, I won't be, but I could suggest that.
There has to be a better way.
Can anyone chime in on the other recent issues, such as the previous/next links disappearing in some places?
36 balupton Sep 09, 2006 11:22
Here is the updated functions you should of got;
/**
* Display a link to next page of posts
*
* Note: remove this tag from skin template if you don't want this functionality
*
* @todo move to ItemList
*/
function next_posts_link($label='#', $max_page=0, $page='')
{
global $p, $paged, $result, $Settings, $MainList, $Blog, $Item;
if( $label == '#' ) $label = T_('Next Page').' >>';
if (!$max_page) $max_page = $MainList->get_max_paged();
if (!$paged) $paged = 1;
$nextpage = intval($paged) + 1;
if (empty($p) && (empty($paged) || $nextpage <= $max_page))
{
/*
// fplanque>> this code was supposed to make this work on multiple domains, but it breaks stub files !
// blueyed>> it looks like using $Blog->get('url') should do it.
$siteurl = $Blog->get( 'siteurl', 'raw');
if ( !empty( $siteurl ) )
{
$parsed_url = parse_url( $Blog->get( 'siteurl', 'raw' ) );
$page = $parsed_url['scheme'] . '://' .
$parsed_url['host'] .
$parsed_url['path'];
}
*/
echo '<a href="';
echo next_posts($max_page, $page);
echo '">'. htmlspecialchars($label) .'</a>';
} else
echo htmlspecialchars($label);
}
/**
* Display a link to previous page of posts
*
* Note: remove this tag from skin template if you don't want this functionality
*
* @todo move to ItemList
*/
function previous_posts_link($label='#', $page='')
{
global $Settings, $p, $paged, $Blog;
if( $label == '#' ) $label = '<< '.T_('Previous Page');
if( empty($p) && ($paged > 1) )
{
/*
// fplanque>> this code was supposed to make this work on multiple domains, but it breaks stub files !
// blueyed>> it looks like using $Blog->get('url') should do it.
$siteurl = $Blog->get( 'siteurl', 'raw');
if ( !empty( $siteurl ) )
{
$parsed_url = parse_url( $Blog->get( 'siteurl', 'raw' ) );
$page = $parsed_url['scheme'] . '://' .
$parsed_url['host'] .
$parsed_url['path'];
}
*/
echo '<a href="';
echo previous_posts( $page );
echo '">'.htmlspecialchars($label).'</a>';
} else
echo htmlspecialchars($label);
}
/**
* Links to previous/next page
*
* Note: remove this tag from skin template if you don't want this functionality
*
* @todo move to ItemList
*/
function posts_nav_link($sep=' :: ', $prelabel='#', $nxtlabel='#', $page='', $previous_before = '', $previous_after = '', $next_before = '', $next_after = '')
{
global $p, $Settings, $MainList;
if( !empty( $MainList->sql ) && empty($p) )
{
$max_paged = $MainList->total_pages;
if( $max_paged > 1 )
{
echo $previous_before;
previous_posts_link( $prelabel, $page );
echo $previous_after;
echo htmlspecialchars($sep);
echo $next_before;
next_posts_link( $nxtlabel, $max_paged, $page );
echo $next_after;
}
}
}
Call by the same code i posted earlier, which would be;
echo '<ul>';
posts_nav_link('','Previous Post','Next Post','<li class="previous-post">','</li>','<li class="next-post">','</li>');
echo '</ul>';
37 squidmaster Sep 09, 2006 22:07
I had to move the $page variable to the end of the line, but this worked great. I also removed one of the list end variables since I only needed one. Thanks! I feel better about this one for sure.
Is there a separate file (or files) that controls how pages display for extra pages of multipage posts, extended posts, and category pages?
My previous/next sections are just not getting called in any of those circumstances.
Example:
http://blvdpark.org/AOtest/blogs/index.php?blog=2&p=20&more=1&page=2
This is the worst offender. The others collapse but it just makes the bottom border of the bPost area look thicker.
I would like to maintain this functionality on all pages, but if I have to I guess I can remove it from the posts area in all cases. Since it would appear on the side when it's available at all, this would not be a horrible loss.
38 squidmaster Sep 10, 2006 00:53
I think I found a solution to my problem, if somebody can tell me how to create a link to the top of the page in php. I am pretty sure that a straight xhtml <a href="#">Link</a> will in fact link to a php page that is inaccessible. I need a way to create this effect so that the top of the page means whatever page the user is on.
I am guessing this is a lot easier than forcing the previous/next stuff to stick around on all pages. If not let me know.
- edit -
Found this on another thread.
39 squidmaster Sep 10, 2006 02:56
Ok, everything is now working as far as I can tell. I only have a few minor issues left, and if I have to I'm going to go ahead with the install even if they do not resolve.
Here's what's left:
I had to comment out the action messages in _main.php to get rid of the empty div that it generates. What I really want is a code snippet that will display it when it is needed, and not print the div when it's not.
I had to modify the archives and categories plugins for proper display in my design. I'd like to be able to avoid overwriting these, and instead call them from another location or maybe pass in variables to get stuff to print. The plugin calls are too advanced for me to be able to figure that one out based on the edits I've made so far, unfortunately.
[/list:u]
Do I need to create a stub file for this skin? It seems to be working properly without one on my test site.
I solved some issues on my way down the _main.php page... Here's my first that wasn't answered in some manner in the online manual.
What are the parameters for the posts_nav_link function?
_main.php looks like this:
Which of course prints these links in one bold paragraph.
What I want is this:
<ul>
<li>Previous Post</li>
<li>Next Post</li>
</ul>
... and I would like those two categories to appear even if they are not links. Maybe this is already possible with the function, but I have no idea how to find out.
Alternatively, could someone suggest a new function, or should I perhaps un-comment out the old one and try to use that in some modified form?