Jump to content

Php Wordwrap


melchedsik

Recommended Posts

Hello, i am having problems where on users profiles where they can write a bio about themselves after 60 characters it start running over on my design. How can i from the existing php code below make it where it goes to 50 characters then wraps to the second line the after 50 characters go to third line until 500 word max is reached?

 

 

Here is a copy of the code:

 

<?php

include 'core/init.php';

include 'includes/overall/header.php';

?>

<h1>Users</h1>

<?php

$users = list_users(4, (isset($_GET['page']) && $_GET['page'] != 0) ? $_GET['page'] : 1);

$pages = $users['pages'];

unset($users['pages']);

foreach($users as $user) {

?>

 

<div class="user">

<a href="profile.php?username=<?php echo $user['username']; ?>"><img src="<?php echo $user['profile']; ?>"></a>

<div class="data">

<h2><a href="profile.php?username=<?php echo $user['username']; ?>"><?php echo $user['username']; ?></a> (<?php echo $user['first_name'], ' ', $user['last_name']; ?>)</h2>

<p><?php echo $user['email']; ?></p>

<p><?php echo (empty($user['bio']) === false) ? substr($user['bio'], 0,60) . '...' : ''; ?></p>

 

</div>

<div class="clear"></div>

</div>

<?php

}

for($x = 1; $x <= $pages; $x++) {

?>

<a href="users.php?page=<?php echo $x; ?>"><?php echo $x; ?></a>

<?php

}

?>

<?php include 'includes/overall/footer.php'; ?>

Link to comment
https://forums.phpfreaks.com/topic/269902-php-wordwrap/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.