 |

Capt'n Morgan
User
Aug 15, 2008, 10:29 AM
Post #1 of 9
(2283 views)
Shortcut
|
|
Help creating intitial section structure
|
Can't Post
|
|
I'm building my first site using CMSB for almost the entire site. This site is setup with 4 top level pages, and each of those pages has several pages beneath it. I was planning to create sections for each of those top level pages, and then put their sub pages as items within the respective section. However if I do that, then the styling of each of the sub pages has to be identical. That's not a big deal, exceptfor a masthead photo that is unique to each page. I don't need that photo to be editable or changeable, I really just need it to be a fixed design element. Any thoughts on how to accomplish this? If I don't go that route, I'll just need to add each page in as a separate section. It seems though that the menu bar in the CDSB admin will get rather cluttered with 20 or sections. Is there any other way to group these?
|
|
|  |
 |

Capt'n Morgan
User
Aug 15, 2008, 12:46 PM
Post #2 of 9
(2267 views)
Shortcut
|
|
Re: [Capt'n Morgan] Help creating intitial section structure
[In reply to]
|
Can't Post
|
|
Iv'e been working on this for a bit, and I think I found a good way to do it, by including the mastehead image as a uploadable field (only I set it to only be editable by admin). What I would like to figure out now, is how can I modify the viewer code for this section so that if a image isn't uploaded, it will display a default image in that area instead?
|
|
|  |
 |

Dave
Staff
/ Moderator

Aug 15, 2008, 1:37 PM
Post #3 of 9
(2259 views)
Shortcut
|
|
Re: [Capt'n Morgan] Help creating intitial section structure
[In reply to]
|
Can't Post
|
|
Hi Capt'n, Your upload field will be named something like this: $record['uploads']. If it's named differently use the name from you code and try this: <?php if (!$record['uploads']): ?> No masthead! <img src="..." /> <?php endif ?> The ! means no or not, so basically that means "if no uploads - show this". Let me know if that does the trick for you. Dave Edis - Senior Developer interactivetools.com
|
|
|  |
 |

Capt'n Morgan
User
Aug 15, 2008, 2:02 PM
Post #4 of 9
(2253 views)
Shortcut
|
|
Re: [Capt'n Morgan] Help creating intitial section structure
[In reply to]
|
Can't Post
|
|
Thanks, Dave. This is my source for that. I can't quite figure out where to put your code, can you help? I'm sure I can take out the thumbnail and download code too, but I haven't got that far. <!-- STEP3: Display Uploads from 'masthead_image' (Paste this where you want your uploads displayed) --> <!-- Upload Program Fields : num, createdTime, tableName, fieldName, recordNum, preSaveTempId, filePath, filename, extension, thumbFilePath --> <!-- Upload Image Fields : isImage, hasThumbnail, urlPath, width, height, thumbUrlPath, thumbWidth, thumbHeight --> <!-- Upload Info Fields : info1, info2, info3, info4, info5 --> <?php if ($about_usRecord): ?> <?php foreach (getUploads($about_usOptions['tableName'], 'masthead_image', $about_usRecord['num']) as $upload): ?> <?php if ($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 ?> <?php endif ?> <!-- STEP3: /Display Uploads from 'masthead_image' -->
(This post was edited by Capt'n Morgan on Aug 15, 2008, 2:07 PM)
|
|
|  |
 |

Dave
Staff
/ Moderator

Aug 15, 2008, 2:53 PM
Post #5 of 9
(2246 views)
Shortcut
|
|
Re: [Capt'n Morgan] Help creating intitial section structure
[In reply to]
|
Can't Post
|
|
Hi Capt'n, Put it just below the endforeach like this: <?php endforeach ?> ... insert code here... <?php endif ?> Let me know if you have any troubles with that. Dave Edis - Senior Developer interactivetools.com
|
|
|  |
 |

Capt'n Morgan
User
Aug 15, 2008, 3:18 PM
Post #6 of 9
(2238 views)
Shortcut
|
|
Re: [Dave] Help creating intitial section structure
[In reply to]
|
Can't Post
|
|
I must be close, but something's not right. Maybe my record or variable name? <!-- Upload Program Fields : num, createdTime, tableName, fieldName, recordNum, preSaveTempId, filePath, filename, extension, thumbFilePath --> <!-- Upload Image Fields : isImage, hasThumbnail, urlPath, width, height, thumbUrlPath, thumbWidth, thumbHeight --> <!-- Upload Info Fields : info1, info2, info3, info4, info5 --> <?php if ($about_usRecord): ?> <?php foreach (getUploads($about_usOptions['tableName'], 'masthead_image', $about_usRecord['num']) as $upload): ?> <?php if ($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 ?> <?php if (!$about_usRecord['masthead_image']): ?> No masthead! <img src="images/header.jpg" /> <?php endif ?> <?php endif ?>
|
|
|  |
 |

Dave
Staff
/ Moderator

Aug 15, 2008, 4:13 PM
Post #7 of 9
(2232 views)
Shortcut
|
|
Re: [Capt'n Morgan] Help creating intitial section structure
[In reply to]
|
Can't Post
|
|
Oh, sorry I didn't realize you were using an older version. We updated the code generator a few months ago to automatically load uploads. Try this (changes in red): <?php if ($about_usRecord): ?> <?php $uploads = getUploads($about_usOptions['tableName'], 'masthead_image', $about_usRecord['num']); ?> <?php foreach ($uploads as $upload): ?> ... <?php if (!$uploads): ?> No masthead! <img src="images/header.jpg" /> <?php endif ?> If that doesn't work feel free to send me an email with FTP and CMS login details to dave@interactivetools.com (email, don't post login details to forum) and I can take a look. I'll be able to debug it quicker for you that way. Hope that helps! Dave Edis - Senior Developer interactivetools.com
|
|
|  |
 |

Capt'n Morgan
User
Aug 15, 2008, 4:34 PM
Post #8 of 9
(2229 views)
Shortcut
|
|
Re: [Dave] Help creating intitial section structure
[In reply to]
|
Can't Post
|
|
Yeah, I have .14. I might just upgrade before I get too deep into this...
|
|
|  |
 |

Dave
Staff
/ Moderator

Aug 15, 2008, 4:37 PM
Post #9 of 9
(2228 views)
Shortcut
|
|
Re: [Capt'n Morgan] Help creating intitial section structure
[In reply to]
|
Can't Post
|
|
Well maybe give it a try, and or upgrade if you have a lot more to do. The new code generator is nicer and gives you more options. Your old code will continue to work after you upgrade as well, but the new code you generate might look a little different. Let me know if you need anything else. Dave Edis - Senior Developer interactivetools.com
|
|
|  |
|