How to display several “viewers” on one page?

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

By einslistir - May 8, 2008

I would like to display several viewers on the frontpage, but I couldn’t manage to do it, because I include header.php and footer.php (like this <?php include ("toppur.php") ?>) for better control with the layout. Then I included a page with only a viewer, but now the links aren’t working properly.

When trying to click on the links below “Vegleiðingar” in the left side of http://televarp.fo.space2u.com/index.php, only one of the pages open. The same page open, even if you click on any of the other five links.

On the frontpage I included the file “vegleidingar.php” which only has this code:

<?php

require_once "/home/d26454/public_html/lib/viewer_functions.php";

list($filesRecords, $filesDetails) = getRecords(array(
'tableName' => 'files',
'limit' => '10',
));

?>
<?php foreach ($filesRecords as $filesRecord): ?><a href="<?php echo $filesRecord['_link'] ?>" class="menuSidur"><?php echo $filesRecord['title'] ?></a><br><?php endforeach ?>


I thought, I had found the perfect solution for several viewers, by just including the files, but is that maybe the problem. Or should I do something else, if I want to use several viewers on the frontpage?

Re: [Dave] How to display several “viewers” on one page?

By einslistir - May 8, 2008

Thanks for your help, Dave! The file is attached here...
Attachments:

vegleidingarsida.php 3K

Re: [einslistir] How to display several “viewers” on one page?

By Dave - May 8, 2008

That is odd. It looks right from this end. Want me to login and take a look? Can you send FTP and CMS login details to dave@interactivetools.com? (don't post login details to the forum). I'll take a look and get it sorted out for you.

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

Re: [einslistir] How to display several “viewers” on one page?

By Dave - May 9, 2008

Hi einslistir,

I found the problem!

The vegleidingarSida.php file included topput.php which included vegleidingar.php which had the same list viewer and overwrote the value of $filesRecord.

I updated vegleidingarSida.php and moved the include tag _above_ the other tag and now it works.

You can see here:
http://televarp.fo.space2u.com/vegleidingarSida.php?4

Let me know if you need anything else!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] How to display several “viewers” on one page?

By einslistir - May 9, 2008

Thanks for your help, Dave! But your solution caused another problem. If you look at the letters and characters, both in the menu and the page, they are not the same as the others on the site. I don’t know how or why, but your change somehow disturbed all the faroese characters (that have something to do with either “vegleidingar.php” or “vegleidingarSida.php”), so they turned out to be something funny...

You can see the (big) difference, when you compare how the links under “Vegleiðingar” look like in http://televarp.fo.space2u.com/index.php and in http://televarp.fo.space2u.com/vegleidingarSida.php?4.

So I still ask the same question: How do I use many “viewers” on one page, without conflict between $filesRecord and stuff like that? What I need, is the possibility to use menus from the different sections on the frontpage and as menus on all pages. I don’t think the include works, so maybe you have some other solution, so I can have dynamic links on all pages?

Re: [Dave] How to display several “viewers” on one page?

By einslistir - May 9, 2008

Hi, Dave! Finally, some light at the end of the tunnel. But I’m not sure, it will last, because now I have solved the problem with some JavaScript code, like <body onLoad="clientSideInclude('...');"> and a few other commands. I would rather do it with PHP, but right now JavaScript is the solution for me!

The problem with the funny characters appeared, when <?php include ("toppur.php") ?> was moved to the top of “vegleidingarSida.php”. This was also the problem for me before, and that was why I in first place moved it belove the “LOAD RECORDS” command. I don’t know how or why, but (with yours and my former solution) it messes up the special faroese characters like á, í, ó, ú, ý and ð.

If we now speak about feature requests, I definetely would like to see some solutions on how to include multiple viewers on a kind of a frontpage or similar, because almost every homepages needs to have different menus, like I need with mine. So this is a challenge of great importance!!!

Re: [einslistir] How to display several “viewers” on one page?

By Dave - May 10, 2008

Hi einslistir,

The other thing you can try is just renaming the variables on that page to something that isn't on any other page. For example on vegleidingarSida.php rename $filesRecords to $filesRecords2.

The other issue is probably related to charset. The program defaults to utf-8. If you can, it's good to set your charset to utf-8 with this tag in your page:

<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />

Give it a try, and if you're still having problems send me another email and I'll get in there and fix it for you.

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