Gossamer Forum
Home : Products : Links 2.0 : Customization :

I have some few problems

Quote Reply
I have some few problems
I tried searching here to resolved some encountered problem on customizing the look of my site. Found this forum very but i didnt found answers on some of my problems. Here are some of them:

1. I like to display current long date but instead i got this result Wednesday, December 31 1969
followed this update http://www.gossamer-threads.com/...ing=showdate;#140248

2. Why tag <%category%> in category.html is not generating?

here's what i have for : see attachment

best regards,
dtoolbox
Quote Reply
Re: [dtoolbox] I have some few problems In reply to
dtoolbox wrote:
here's what i have for : see attachment

I don't see an attachment.
Quote Reply
Re: [Bobsie] I have some few problems In reply to
how can i make the attachment visible to others? here's a try
Quote Reply
Re: [dtoolbox] I have some few problems In reply to
You didn't put the mod in the right place. It said:

Quote:
Add the following codes in the sub site_html_link routine in the site_html_templates.pl file:

Code:
my $showdate = &long_date($rec{'Date'});

You didn't put it in the sub site_html_link routine. I suggest you remove what you did and remodify following the instructions carefully!
Quote Reply
Re: [Bobsie] I have some few problems In reply to
thanks for the reply bobsie :) but what i want is to use <%showdate%> on all templates thats why i put it on global instead on site_html_link sub.
Quote Reply
Re: [Bobsie] I have some few problems In reply to
Bobsie wrote:
You didn't put the mod in the right place. It said:

You didn't put it in the sub site_html_link routine. I suggest you remove what you did and remodify following the instructions carefully!

ok i tried the instruction but still getting a wrong date showing Wednesday, December 31 1969
Quote Reply
Re: [dtoolbox] I have some few problems In reply to
dtoolbox wrote:
thanks for the reply bobsie :) but what i want is to use <%showdate%> on all templates thats why i put it on global instead on site_html_link sub.

Oh, I didn't notice that in your initial message. All I saw is that you tried the referenced mod and it doesn't do it globally.

dtoolbox wrote:
ok i tried the instruction but still getting a wrong date showing Wednesday, December 31 1969

Can you post the appropriate files (attachment) again so I can see what you have done specifically? Include both your site_html_templates.pl and links.cfg.
Quote Reply
Re: [Bobsie] I have some few problems In reply to
for links.cfg i never change anthing beyond the date routines.

# Date Routines
# --------------------------------------------------------
# Your date format can be whatever you like, as long as the following
# two functions are defined &date_to_unix and &unix_to_date:
# The default is dd-mmm-yyyy.
sub date_to_unix {
# --------------------------------------------------------
# This routine must take your date format and return the time a la UNIX time().
# Some things to be careful about..
# timelocal does not like to be in array context, don't do my($time) = timelocal (..)
# int your values just in case to remove spaces, etc.
# catch the fatal error timelocal will generate if you have a bad date..
# don't forget that the month is indexed from 0!
#
my $date = shift; my $i;
my %months = map { $_ => $i++ } qw!Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec!;
my ($day, $mon, $year) = split(/-/, $date);

exists $months{$mon} or return undef;
$day = int($day); $year = $year - 1900;

require Time::Local;
my $time = 0;
eval {
$time = &Time::Local::timelocal(0,0,0, $day, $months{$mon}, $year);
};
if ($@) { die "invalid date format: $date - parsed as (day: $day, month: $months{$mon}, year: $year). Reason: $@"; }
return $time;
}
sub unix_to_date {
# --------------------------------------------------------
# This routine must take a unix time and return your date format
# A much simpler routine, just make sure your format isn't so complex that
# you can't get it back into unix time.
#
my $time = shift;
my ($sec, $min, $hour, $day, $mon, $year, $dweek, $dyear, $tz) = localtime $time;
my @months = qw!Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec!;
$year = $year + 1900;
return "$day-$months[$mon]-$year";
}
sub long_date {
# --------------------------------------------------------
# This routine is for printing a nicer date format on the what's new page. It should
# take in a date in your current format and return a new one.
my $time = shift;

$time = &date_to_unix ($time);
my ($sec, $min, $hour, $day, $mon, $year, $dweek, $dyear, $tz) = localtime $time;
my @months = qw!January February March April May June July August September October November December!;
my @days = qw!Sunday Monday Tuesday Wednesday Thursday Friday Saturday!;
$year = $year + 1900;
return "$days[$dweek], $months[$mon] $day $year";
}


and also i already check my local time setting on the server and it is on the right date and time. really weird :-P
Quote Reply
Re: [dtoolbox] I have some few problems In reply to
Is there a URL I can look at to see the date that is being presented?
Quote Reply
Re: [Bobsie] I have some few problems In reply to
im using local server not yet online on public Frown
Quote Reply
Re: [dtoolbox] I have some few problems In reply to
In site_html_template.pl, sub site_html_category, you have this:

Code:
return &load_template ( 'category.html', {
date => $date,
time => $time,
long_date => $long_date,
... remainder removed for brevity ...

You do not need the "long_date => $long_date," line since you have already globally defined $showdate as being equivalent to &long_date. Try removing that line and see if it fixes the problem. In your template file, use <%showdate%> instead of <%long_date%>.

Last edited by:

Bobsie: Oct 17, 2007, 11:33 AM
Quote Reply
Re: [Bobsie] I have some few problems In reply to
thanks for the quick reply bobsie. I removed it now but still getting a wrong date Wednesday, December 31 1969.

btw how about on <%category%> how can make this tag to work on every templates? seems right now it only works on home.html but when i put it on category.html it doesnt generate anything. Shocked
Quote Reply
Re: [dtoolbox] I have some few problems In reply to
dtoolbox wrote:
thanks for the quick reply bobsie. I removed it now but still getting a wrong date Wednesday, December 31 1969.

I need to see how you are calling the date. Everything looks okay in the script and links.cfg. What template is returning the wrong date? Please attach it.

Quote:
btw how about on <%category%> how can make this tag to work on every templates? seems right now it only works on home.html but when i put it on category.html it doesnt generate anything. Shocked

Again, I need to see the template you created that calls it. Otherwise, I would just be guessing.
Quote Reply
Re: [Bobsie] I have some few problems In reply to
all are default template comes with the zip file. i just added the this lines:

================================================
<h2>Categories:</h2>
<%category%>

<p class="grandtotal">
There are <strong><%grand_total%></strong> links for you to choose from!
</p>
============================================


=======================
category.html
=======================
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/...EC-html40/strict.dtd">
<html>

<head>
<title><%site_title%>: <%category_name%></title>

<%if meta_name%>
<meta name="description" content="<%meta_name%>">
<%endif%>

<if meta_keywords%>
<meta name="keywords" content="<%meta_keywords%>">
<%endif%>

<link rel=stylesheet href="<%build_root_url%>/links.css" type="text/css" title="<%site_title%> style sheet">
</head>
<body>


<p><strong class="title"> <%title_linked%> </strong></p>

<h1><%site_title%>: <%category_clean%></h1>


<p>
<small class="menu">|

<a class="menulink" href="<%build_root_url%>">Home</a> |
<a class="menulink" href="<%db_cgi_url%>/add.cgi">Add a Site</a> |

<a class="menulink" href="<%db_cgi_url%>/modify.cgi">Modify a Site</a> |

<a class="menulink" href="<%build_root_url%>/New">What's New</a> |

<a class="menulink" href="<%build_root_url%>/Cool">What's Cool</a> |

<a class="menulink" href="<%build_root_url%>/Ratings">Top Rated</a> |

<a class="menulink" href="<%db_cgi_url%>/jump.cgi?ID=random">Random Link</a> |

<a class="menulink" href="<%db_cgi_url%>/search.cgi">Search</a> |

</small>
</p>


<!-- Added this line from home.html -->
<h2>Categories:</h2>
<%category%>


<p class="grandtotal">
There are <strong><%grand_total%></strong> links for you to choose from!
</p>

<!-- end of category list -->


<!-- Subcategories-->

<%if category%>

<h2>Categories:</h2>

<%category%>

<%endif%>

<!-- Links in this category. -->

<%if links%>

<h2>Links: </h2>

<%links%>

<%endif%>

<!-- Next/Previous links if spanning pages. -->

<p align=center>

<%if prev%>

<small><a href="<%prev%>">Prev <%build_links_per_page%></a></small>

<%endif%>

<%if next%>

<small><a href="<%next%>">Next <%build_links_per_page%></a></small>

<%endif%>

</p>


<!-- Related Categories -->

<%if related%>

<h2>Related Categories:</h2>

<ul><%related%></ul>

<%endif%>

<!-- Search Bar -->

<form action="<%db_cgi_url%>/search.cgi" method="GET">

<h2>Search</h2>

<div class="margin">

<table border="0" cellspacing="0" cellpadding="0">

<tr><td><strong class="search">Looking for something in particular?</strong></td></tr>

<tr><td><input type="text" size=15 name="query"> <input type=submit value="Search!"></td></tr>

<tr><td><small class="more"><a href="<%db_cgi_url%>/search.cgi">More search options</a></small></td></tr>

</table>

</div>

</form>

<p><small class="update">Pages Updated On: <%date%> - <%time%><br>
Links Engine 2.0 By: <a href="http://www.gossamer-threads.com/">Gossamer Threads Inc.</a>
</small></p>


</body>
</html>
Quote Reply
Re: [dtoolbox] I have some few problems In reply to
What does display instead of <%category%>? Do you see an error message of any type?

It is extremely hard to figure this out without being able to see what is happening. I am beginning to wonder if this may not be a problem with the localhost you are using. Sometimes things work one way locally, but another way online. I am not saying that is the case here, but I am just not sure what is happening.
Quote Reply
Re: [Bobsie] I have some few problems In reply to
here's the link

http://blogweavers.com/links/

you'll notice that date display Wednesday, December 31 1969

and on this page http://blogweavers.com/links/Wordpress_Themes/

where's the list of category? why it cant generate on category.html
Quote Reply
Re: [dtoolbox] I have some few problems In reply to
Re Your second link:

That area would list subcategories of Wordpress Themes, like Wordpress_Themes/Business, which would then display 'Business' under the Categories heading.


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] I have some few problems In reply to
Hi PerlFlunkie thank you for joining my thread Smile

PerlFlunkie wrote:
Re Your second link:

That area would list subcategories of Wordpress Themes, like Wordpress_Themes/Business, which would then display 'Business' under the Categories heading.

I want the main categories to be visible on all pages without subcategories yet. How can i do that? It seems tag <%category%> only work on home.html template
Quote Reply
Re: [dtoolbox] I have some few problems In reply to
This'll do it...

http://www.gossamer-threads.com/...0all%20pages;#237907


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] I have some few problems In reply to

thanks for pointing me at the correct thread you're such a big help.

last thing how about the problem on displaying long date? is there a solution already?