Main
Index
Search
Posts
Who's
Online
Log
In

Home: Products: CMS Builder:
Help

 

 


kcmedia
User

Aug 25, 2010, 3:13 PM

Post #1 of 15 (1937 views)
Shortcut
Help Can't Post

Hi

I have this new website that i am building and i need some help guys.

I have this section called sponsors where you upload images and put in some wording about them along with a url for each sponsor.

then in another section called events we have details about the event and the client wants to drag the sponsors section into the events area but when they setup the sponsors area it will allow them to select which sponsors they want for that event.

it sound all over the place i know but when it is working it will be good for the client.

can someone help.

thanks

Craig
Thanks

Craig
KC Media Solutions
www.kcmedia.biz


Jason
Staff / Moderator


Aug 25, 2010, 4:14 PM

Post #2 of 15 (1935 views)
Shortcut
Re: [kcmedia] Help [In reply to] Can't Post

Hi Craig,

So in the events section, they want to be able to select sponsors the sponsors they want to associate with a particular event. Is that right?

If so, you can set up a multi value list field in the events section that pulls its information from the sponsors table.

If I don't have it right, please provide some more clarification on exactly what needs to happen and what fields exist in each section.

Hope this helps
---------------------------------------------------
Jason Sauchuk - Programmer 
interactivetools.com

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


kcmedia
User

Aug 25, 2010, 5:07 PM

Post #3 of 15 (1933 views)
Shortcut
Re: [Jason] Help [In reply to] Can't Post

Hi Jason

I sent you a message did you get it.
Thanks

Craig
KC Media Solutions
www.kcmedia.biz


kcmedia
User

Aug 26, 2010, 2:03 PM

Post #4 of 15 (1908 views)
Shortcut
Re: [kcmedia] Help [In reply to] Can't Post

Hi Jason

here is the file you wanted.
Thanks

Craig
KC Media Solutions
www.kcmedia.biz
Attachments: the-event.php (7.30 KB)


Jason
Staff / Moderator


Aug 27, 2010, 9:11 AM

Post #5 of 15 (1901 views)
Shortcut
Re: [kcmedia] Help [In reply to] Can't Post

Hi,

Try adding this code to where you're selecting your records (I've highlighted the changes in red):


Code
 
// load records
list($the_eventRecords, $the_eventMetaData) = getRecords(array(
'tableName' => 'the_event',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$the_eventRecord = @$the_eventRecords[0]; // get first record

$sponsorList = trim($the_eventRecord['sponosors'],"\t");
$sponsorList = "(".str_replace("\t",",",$sponsorList).")";

list($sponsorRecords,$sponsorMetaData)=getRecords(array(
'tableName' => 'sponsors',
'allowSearch' => false,
'where' => "title IN $sponsorList",
));



This code will put all of the sponsors associated with the event into $sponsorRecords. You can then output this information anywhere you want.

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Programmer 
interactivetools.com

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


kcmedia
User

Aug 27, 2010, 7:32 PM

Post #6 of 15 (1890 views)
Shortcut
Re: [Jason] Help [In reply to] Can't Post

Hi Jason

I tried that but still no images for the sponsors showing up.
Thanks

Craig
KC Media Solutions
www.kcmedia.biz
Attachments: the-event.php (7.63 KB)


kcmedia
User

Aug 30, 2010, 2:19 PM

Post #7 of 15 (1819 views)
Shortcut
Re: [kcmedia] Help [In reply to] Can't Post

Hi Jason

any update?
Thanks

Craig
KC Media Solutions
www.kcmedia.biz


Chris
Staff


Aug 30, 2010, 3:18 PM

Post #8 of 15 (1816 views)
Shortcut
Re: [kcmedia] Help [In reply to] Can't Post

Hi kcmedia,

Jason isn't in the office today, but maybe I can help.

This may be unrelated, but I noticed what seems like a typo in the code above. Should this read "sponsors"?


Code
  $sponsorList = trim($the_eventRecord['sponosors'],"\t");


I took a look at your the-event.php code and noticed that you aren't using $sponsorRecords anywhere. You'll need to add some code where you want your images in your page to loop over the sponsors you've selected and display their uploads:


Code
<?php foreach ($sponsorRecords as $sponsor): ?> 
<!-- STEP 2a: Display Uploads for field 'uploads' (Paste this anywhere inside STEP2 to display uploads) -->
<!-- Upload Fields: num, createdTime, tableName, fieldName, recordNum, preSaveTempId, filePath, filename, extension, thumbFilePath, isImage, hasThumbnail, urlPath, width, height, thumbUrlPath, thumbWidth, thumbHeight, info1, info2, info3, info4, info5 -->
<?php foreach ($sponsor['uploads'] as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" /><br/>

<?php elseif ($upload['isImage']): ?>
<img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" /><br/>

<?php else: ?>
<a href="<?php echo $upload['urlPath'] ?>">Download <?php echo $upload['filename'] ?></a><br/>

<?php endif ?>
<?php endforeach ?>
<!-- STEP2a: /Display Uploads -->
<?php endforeach ?>


I hope this helps. Please let me know if you have any questions.
Chris


kcmedia
User

Aug 30, 2010, 3:55 PM

Post #9 of 15 (1814 views)
Shortcut
Re: [chris] Help [In reply to] Can't Post

Hi Chris

I have tried that also and no good check out the error code on the page

http://champagneforcharity.org/the-event.php

craig
Thanks

Craig
KC Media Solutions
www.kcmedia.biz
Attachments: the-event.php (8.65 KB)


Jason
Staff / Moderator


Aug 31, 2010, 8:46 AM

Post #10 of 15 (1794 views)
Shortcut
Re: [kcmedia] Help [In reply to] Can't Post

Hi Craig,

I think we'll have to take a look on your server to see exactly what's happening. Please fill out a 2nd Level Support Request here:
https://www.interactivetools.com/support/email_support_form.php

and I'll take a closer look at this.

Thanks.
---------------------------------------------------
Jason Sauchuk - Programmer 
interactivetools.com

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


Jason
Staff / Moderator


Aug 31, 2010, 12:02 PM

Post #11 of 15 (1779 views)
Shortcut
Re: [kcmedia] Help [In reply to] Can't Post

Hi Craig,

Chris and I were going over this problem, and think we may have found it. Trying changing your code to this:


Code
 $sponsorList = trim($the_eventRecord['sponosors'],"\t");  
$sponsorList = "('".str_replace("\t","','",mysql_escape($sponsorList))."')";

list($sponsorRecords,$sponsorMetaData)=getRecords(array(
'tableName' => 'sponsors',
'allowSearch' => false,
'where' => "title IN $sponsorList",
));


This will place single quotes around each of the items in your list and should get rid of that MySQL error.

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Programmer 
interactivetools.com

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


kcmedia
User

Aug 31, 2010, 2:03 PM

Post #12 of 15 (1775 views)
Shortcut
Re: [Jason] Help [In reply to] Can't Post

Hi Jason

spot on mate perfect, just one more small thing in the sponsors area for each sponsor we put their website address i want to link the images on the event page tot he sponsors website that is set in the sponsors area.

how do i go about that have a look at the event file now how i did it but it dosnt work.
Thanks

Craig
KC Media Solutions
www.kcmedia.biz
Attachments: the-event.php (8.76 KB)


Jason
Staff / Moderator


Aug 31, 2010, 2:14 PM

Post #13 of 15 (1773 views)
Shortcut
Re: [kcmedia] Help [In reply to] Can't Post

Hi,

It looks like you just need to change one name so that you're outputting the link from the sponsor record.

Try changing your code to this (the change is in red):


Code
<!-- STEP 2a: Display Uploads for field 'uploads' (Paste this anywhere inside STEP2 to display uploads) -->  
<!-- Upload Fields: num, createdTime, tableName, fieldName, recordNum, preSaveTempId, filePath, filename, extension, thumbFilePath, isImage, hasThumbnail, urlPath, width, height, thumbUrlPath, thumbWidth, thumbHeight, info1, info2, info3, info4, info5 -->
<?php foreach ($sponsor['logo'] as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<a href="<?php echo $sponsor['website_url'] ?>" target="_blank"><img src="<?php echo $upload['thumbUrlPath'] ?>" alt="" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" vspace="3" border="0" /></a><br/>

<?php elseif ($upload['isImage']): ?>
<img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" /><br/>

<?php else: ?>
<a href="<?php echo $upload['urlPath'] ?>">Download <?php echo $upload['filename'] ?></a><br/>

<?php endif ?>
<?php endforeach ?>
<!-- STEP2a: /Display Uploads -->


Hope this helps
---------------------------------------------------
Jason Sauchuk - Programmer 
interactivetools.com

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


kcmedia
User

Aug 31, 2010, 2:21 PM

Post #14 of 15 (1771 views)
Shortcut
Re: [Jason] Help [In reply to] Can't Post

Hi Jason

oh yes now i understand how you have this working.

great thank you very much that just finished the site right now all good to go.

cheers

Craig
Thanks

Craig
KC Media Solutions
www.kcmedia.biz


gkornbluth
Veteran

Aug 31, 2010, 3:02 PM

Post #15 of 15 (1756 views)
Shortcut
Re: [kcmedia] Help [In reply to] Can't Post

hi Jason, Chris and Craig,

Just curious, could you have used the Related Record Lookup Functions Plugin with a multi value pulldown list for this as well?

Nice to learn another way though.

Best,

Jerry
The first CMS Builder reference book is now available on-line!
http://www.thecmsbcookbook.com

(This post was edited by gkornbluth on Aug 31, 2010, 3:03 PM)