If statement

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

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

By design9 - June 7, 2010

Thanks Chris! That is what I needed! Works great!

April