If statement

16 posts by 4 authors in: Forums > CMS Builder
Last Post: June 7, 2010   (RSS)

By design9 - June 1, 2010

Chris,
I am just getting around to this but this is still not working correctly for me. On the index page, it is not pulling in the title that you are clicking on...(it says little otter swim for all advertisers). Then on the details page, it is still not showing ads only for that specific advertiser. It will sometimes show ads for advertisers that you didn't click on. I need it to show only ads, coupons, classifieds for that specific advertiser you clicked on. I have attached my pages as well.

Here are the links:
Main Page:
http://www.charlotteparent.com/test/marketplace/index.php

Details page:
http://www.charlotteparent.com/test/marketplace/detailsfa.php

Can you look and see if I did something incorrectly or if we need different coding?

Thanks!
April
Attachments:

index_020.php 25K

detailsfa.php 22K

Re: [apdance9] If statement

By Jason - June 2, 2010

Hi April,

It looks like the problem is that the same title is being put into each of the links (PetsMart).

Try replacing the line where you're outputting your link with this:

<div id="markettitle"><a href="detailsfa.php?title=<?php echo urlencode($row['title']);?>"><?php echo $row['title'] ?></a></div>

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] If statement

By design9 - June 3, 2010

Thanks Jason!

That did the trick!

April

Re: [apdance9] If statement

By design9 - June 4, 2010

Jason,
I just found two more issues that I need help with.

1) When I click on a advertiser title on the main index page (http://www.charlotteparent.com/test/marketplace/index.php) and it takes you to the details page, I want the title to show up in the green box on the details page (http://www.charlotteparent.com/test/marketplace/detailsfa.php). However, I need to create some type of array so it will pull in the title whether it is coming from $marketplaceRecords, $marketplace_couponsRecords or $marketplace_classifiedsRecords. Currently it is only showing the $marketplaceRecords title because that is the code on that page. Just need to figure out to get them all to pull in. I have attached the latest pages.

2)I have a all Featured ads page (http://www.charlotteparent.com/test/marketplace/featured.php). However, I need to change something so when you click on the advertiser title and it goes to the details page, it works like the index page does and only shows the featured ad for that advertiser. Right now, it is having the same type of issue as before, where it is showing all ads instead of the one ad. This page's coding is a little different than the index.php page so I am not sure what I should add to make it work. I have also attached this page of coding.

Thanks!
April

Re: [apdance9] If statement

By Chris - June 4, 2010 - edited: June 4, 2010

Hi April,

For (1) you can do this:

<?php
if ($marketplaceRecord) {
echo $marketplaceRecord['title'];
}
elseif ($marketplace_couponsRecord) {
echo $marketplace_couponsRecord['title'];
}
elseif ($marketplace_classifiedsRecord) {
echo $marketplace_classifiedsRecord['title'];
}
?>


For (2), I think you just need to make the same change you made to your index page. Try changing this:

<?php if ($record['featured_ad']): ?><a href="<?php echo $record['_link'] ?>"><span class="body3"><b><?php echo $record['title'] ?></b></span></a>

to this:

<?php if ($record['featured_ad']): ?><a href="detailsfa.php?title=<?php echo urlencode($record['title']);?>"><span class="body3"><b><?php echo $record['title'] ?></b></span></a>

Does that help? Please let me know if you have any questions.
All the best,
Chris