Let's say, I want the users to be able to customize the layout/format of results. Like for example, a business card: Users can format it in their own ways:
Name: $name
Address: $address
Telephone: $telnum
// or
Ho! My name is $name and I live at $address. Call me! $telnum
How could I be able to implement custom user layouts/formats? Like in a framework each user can have a custom view.
You can use templates to accomplish this quite easily. In the user settings have a textbox where people can select the layout they want. Then, when you're showing results to user, take the textbox data (Saved in database), and str_replace what needs to be replaced.
I recommend, for user simplicity, to use {{name}} / {{address}} / {{telnum}}, which makes str_replace-ing quite easy.
EDIT:
Let's say, I want my card to look like this:
NAME
ADDRESS
Don't forget to call me! TELNUM
I would put this in the setting page
{{name}}
{{address}}
Don't forget to give me a call! {{telnum}}
You're code would then save that when I hit save in the settings page, and when you're retrieving details / showing my my card, you would:
$usercard = $usersettings['layout'];
$usercard = str_replace('{{name}}', $userdata['name'], $usercard);
....
Hope helps!