Problem with time stamp or something like that

9 posts by 2 authors in: Forums > CMS Builder
Last Post: May 26, 2008   (RSS)

By einslistir - May 22, 2008 - edited: May 22, 2008

I am still working on the same homepage, where I now have copied old news, so some of the stuff from the old page will show up in the new one.

To keep the dates, I did create news with older dates, but now they do not show up on the frontpage (http://televarp.fo.space2u.com/index.php), but only on the news listing page (http://televarp.fo.space2u.com/tidindi.php).

How can I change this, so the news will show up on the frontpage as well? Of course, an almost empty frontpage isn’t much worth...

Hopefully, someone can help me out quickly, because the new homepage will be out on the final domainname later today or at last tomorrow!

Dave, you have my ftp-codes, so you maybe could see what is going wrong?

Re: [einslistir] Problem with time stamp or something like that

By Dave - May 22, 2008

Hi einslistir,

If it's working on your tidindi.php page you can always copy the code from there. The problem is your index.php page is setup to only show anything if the record has a image uploaded. See this code:

<?php foreach ($newsRecords as $newsRecord): ?>
<?php foreach ($newsRecord['uploads'] as $upload): ?>
... record content is displayed here...


So foreach record, it displays the html for each upload, but if there is no upload then nothing will be displayed. I copied some code from lower down the page like this:

<?php foreach ($newsRecords as $newsRecord): ?>

<!-- copied code -->
<table width="480" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="380" class="yvirskrift"><a href="<?php echo $newsRecord['_link'] ?>"><?php echo $newsRecord['title'] ?></a></td>
<td width="100"><div align="right"><?php echo date("d.m.Y", strtotime($newsRecord['date'])) ?></div></td>
</tr>
</table>
<!-- /copied code -->

<?php foreach ($newsRecord['uploads'] as $upload): ?>
...


And now it displays something for each record as you can see here: http://televarp.fo.space2u.com/index.php

Just remember that the html inside the "foreach record" tags gets display once for each record, and the html instead for "foreach uploads" tags gets displayed once for each upload. But if there is no uploads nothing will be displayed.

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [einslistir] Problem with time stamp or something like that

By Dave - May 22, 2008

Hi einslistir,

So is the first issue solved? It seems like http://televarp.fo.space2u.com/index.php is looking better?

You can tell a viewer to skip the first X records with offset, like this:

list($newsRecords, $newsDetails) = getRecords(array(
'tableName' => 'news',
'offset' => '10',
'limit' => '10',
));


So if you have another viewer below you could try that.

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Problem with time stamp or something like that

By einslistir - May 23, 2008

Hi, Dave! The first issue isn’t solved. If you click on the news links on the frontpage, the same image problem is on the page with the full news.

Today this site will be out on the final domain, so I try to do something to make some of the dynamic stuff static. But that is not a solution, just a way to avoid the worst problems with the image issue right now.

Re: [einslistir] Problem with time stamp or something like that

By Dave - May 23, 2008

Hi einslistir,

It's easier for me if we can tackle one problem at a time.

Tell you what, you create a mockup (or post me a link to the old one if it's still around) for the frontpage, explain how it's suppose to work to me, and I'll create the code for you as an example so you can see how to make it work.

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Problem with time stamp or something like that

By einslistir - May 23, 2008

Hi, Dave!

First of all: I’m happy to say, that the site is out now, on the adress www.tv.fo and also www.televarp.fo. It’s not totally dynamic, because I had to do some static pages, so the site could be ready, but I will finish it step-by-step.

What it is all about, when we speak about the situation with images (especially on the frontpage, but also in the news stories itself), is as follows:

1. I want to have the possibility to use images with news stories. On the frontpage they can appear as thumbnails (smaller), and with the news story they can be images (larger).

2. The stories should appear on the frontpage with title (that links to news story), date and a summary - and if there is an image, it should be there as well. If there is no image, the title, date and summary should still be there.

3. The same should be, when you go to one of the stories on the frontpage. Then everything should be there in the same way: Title, date, summary and also content - and an image, if there is any. If there is no image, all the other things should be there, only without an image.

The problem was, that when I did some news stories with no image, they didn’t show up at all. As I understand, it was because of the “foreach” statements, so that might be the problem.

Right now the images is the biggest issue here, and to solve it temporarily (so I could get the site out now, as my customer wished), I had to choose an image for the newest news stories, just to have them to appear on the frontpage.

And to assure, that it was possible for visitors to read the news stories, after they pushed the news links on the frontpage, I had to totally remove the image function in the news stories, because otherwise they wouldn’t appear at all.

The piont is, that I would like to have the possibility to use images, if there are any for the stories. But if there aren’t any images, it should not do anything with the rest of the story. Said with other words: I would have the possibility to present the stories in the same way, if there is an image or not.

Hopefully I made myself clear now. My english isn’t that good, so you have to excuse me for that. But I guess, that now you see and understand my problem…?

Re: [einslistir] Problem with time stamp or something like that

By Dave - May 24, 2008

Hi einslistir,

Thanks for the details! The key is to only have the image "foreach" code around the image code itself, and not anything else.

I think I have it setup the way you want now. Have a look at this page and the code and let me know if it's what you wanted: http://televarp.fo.space2u.com/index2.php

Hope that helps! :)
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Problem with time stamp or something like that

By einslistir - May 26, 2008

Hi, Dave!

That solved the problem! Thank you very much!!!

Now the site is out, but I still have to manage some more pages, and than I can say, it is finished and totally ready for my customer to edit and administrate.

Thanks a lot!

With best regards

Hilmar Jan Hansen

(Einslistir is the name of my company)