how can I create a filter using <?php echo $record['createdBy.fullname'];?>

4 posts by 2 authors in: Forums > CMS Builder
Last Post: July 15, 2014   (RSS)

By willydoit - July 14, 2014

Hi all,

This issue may be due to going down completely the wrong road to resolve another issue I have posted in the forum but, I have a list of blogs being displayed and I can assign a creating author to each blog by using <?php echo $record['createdBy.fullname'];?> which appears to take the authors Name from the accounts table which is just what we want.

However I also want to be able to allow viewers to filter the blogs by author and have a search form as below which I had hoped would work using the same variable but it doesnt work, when included on the page it stops anything after the filter form from loading.

If someone could advise whether 

a) using the <?php echo $record['createdBy.fullname'];?> to display an author name is the correct way to do it - and

b) If it is the correct way, how should I incorporate it into my filter.

Thanks in advance for any help provided, filter code provided below.

<form method="post" action="blog_list.php">


<h3>&nbsp;Filter by Author</h3>

<select name="createdBy.fullname">
<?php foreach (getListOptions('bridlington_blogs', 'createdBy.fullname') as $value => $label): ?>

<option value = "<?php echo $value;?>" <?php selectedIf($value, @$_REQUEST['createdBy.fullname']);?>>

<?php echo $label; ?></option>

<?php endforeach ?>



</select>
<br/>


<div align="center">
<input type="submit" name="search" value=" Show Blogs "/>
</div>



</form>

By willydoit - July 15, 2014

Hi Claire,

I think that what I want to achieve is quite simple and straightforward, given that the answer demands something quite complex it makes me think that I probably arent doing the right things to get what I want in the first place. All I want to do is to have a field within the blogs records which auto populates with the authors name which is contained in the accounts record. You showed me before how to create a drop down list of users taken from a different table but I dont want a list to chose from in this instance, I want the author_ id field to auto populate with the name of the person creating the blog, it would be easy to require the author to input their name manually but that would be a bit amateurish and could result in misspellings which would affect the filters I want to employ.

I do have another question in the forum which preceded this, perhaps a response to that will nullify this issue.

The reason I want to have this information is because I want to be able to provide a drop down list on the viewer page which will allow a viewer to chose from all the contributing authors and be taken to a page which contains all the blogs by that user. It's a pity that you dont have a pre-created template for a multi-user blog facility.

Thanks In advance.

By claire - July 15, 2014

Hi Willy

I think it's probably best if I see the code. Can you email support@interactivetools.com to open a ticket about this and include your cmsAdmin login and FTP details?

Hopefully I'll get a handle on what you want and give you a simpler option.

(I also deleted a few duplicate posts here)

--------------------

Claire Ryan
interactivetools.com

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