View Full Version : limit irite output
muddysmurf
03-18-2009, 07:01 AM
I just want to put a certain amount of characters on my home page, so it doesn't take up too much room and then link to the page where my full content is written. I'm using iRite for my client to enter their data. Well I ran into a slight snag last night.
I'm using this code to shorten my iRite content:
<?php
$tmp=mysql_query("SELECT * FROM myTable ORDER BY id_myTable DESC");
while($row=mysql_fetch_array($tmp)){
$text = $row_rsmyTable'text_myTable'];
$var = ("$text");
$varlength = strlen($var);
$limit = 200;
if ($varlength > $limit) {
$var = substr($var,0,$limit);
}
}
echo "$var...";
?>
It works great, BUT there's an issue. When it cuts off the text, it apparently leaves some of the tags off that iRite writes to format the content.
Is there a way around this? or am I going to have to add another text field on the back end so they can enter a smaller portion of their content to put on the home page?
Ray Borduin
03-18-2009, 08:42 AM
You could write a function to automatically add close tags to any opened tags that were not closed properly and make sure you don't ever cut out mid-tag.... but if you aren't a fairly good scriptor it may be difficult to accomplish. Certainly the small amount of script you have now wouldn't suffice.
Php has a relatively good xml parsing engine, so that would certainly help... you may even be able to find a script that does this by searching the web it can't be all that uncommon.
muddysmurf
03-18-2009, 07:33 PM
another problem :( i'm feeling pretty stupid on this one. lol
It has to do with uploading images with irite. I've got it working locally on php/mysql/apache. I change everything over that I need to, to upload it, and the image doesn't show up.
I have the irite folder inside an admin folder. Inside the irite folder is the userfiles folder that the images go into.
admin/iRite/userfiles
Now, i add /public_html in front of admin and it still doesn't work. I grabbed that link directly off the ftp address...am I missing something?
Ray Borduin
03-19-2009, 06:56 AM
Do the images get uploaded, they just don't display?
If you view the generated src for the image on the page, what exactly is wrong with it?
muddysmurf
03-19-2009, 10:15 AM
I upload everything as is with the config.php change to the server and I would think that the image would show up just like it does locally, but it doesn't.
Well I go to the update page, and go to upload a new image but it gives me an error of
Error creating folder "/public_html/admin/iRite/userfiles/image/" (Can't create directory)
Now the question is, where does the image folder come from? It's not written in the config.php file for iRite. Both the absolute and relative goes to /userfiles.
and I noticed that iRite makes a new folder named userfilesimages but then that link does userfiles/images (when trying to upload the images, I've tried doing the image info tab and the upload tab, both with the same error message)
I've went in and changed the permissions to 777 on all thinking that would help write to the folder, but it doesn't.
I've even tried adding the http address fully to the userfiles folder and it does the same error message.
Ray Borduin
03-19-2009, 10:26 AM
Try manually creating that folder on the server. Maybe it will work once it exists and you won't have to worry about why it wasn't created properly.
vBulletin® v3.8.1, Copyright ©2000-2012, Jelsoft Enterprises Ltd.