Rss with image: $image value

Ask about a PHP problem here.
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Rss with image: $image value

Post by jacek »

1. That's a styling thing, you probably want to put each article in a div tag and add some margin to that tag. It would probably be easier to search for things like "div tag" "css styling" "css positioning" on google, you would find stuff in your own language :)

2. You have to try each method, if it fails move on to the next method and so on. For example you could try

[syntax=php]$entries = $xpath->query('//img');[/syntax]
And then check it using,

[syntax=php]$total = count($entries);[/syntax]
To see how many results you got.
Image
hostingebc
Posts: 28
Joined: Wed Jun 08, 2011 10:31 am

Re: Rss with image: $image value

Post by hostingebc »

1. question

http://www.moravaprom.com/ebchost/prikaz.php

if you see this, you will see the problem:

1. Picture dimension,
2. picture position,
3. link lenght problem (i know how to resolve, becose is separetet from <item> part )

that i can not control if i do not have imege url. for example $urlimage = url img from item;


2.question - thank, i will try. it seems to me logical and understand how to do :)


NOTE: I've mastered the basics of PHP and mjskl's. RSS reader is something new to me, and I see it as useful, because I get into so much detail
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Rss with image: $image value

Post by jacek »

You can set the dimensions of the image just by setting the width and height in the tag like this

[syntax=xhtml]<img src="something" width="100" height="100" />[/syntax]
for 100x100 pixels.
Image
hostingebc
Posts: 28
Joined: Wed Jun 08, 2011 10:31 am

Re: Rss with image: $image value

Post by hostingebc »

Greate, i know for this. Thanks :)

jacek wrote:You can set the dimensions of the image just by setting the width and height in the tag like this

[syntax=xhtml]<img src="something" width="100" height="100" />[/syntax]
for 100x100 pixels.


but somthin is ? which value? which url? that's what interests me? :)
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Rss with image: $image value

Post by jacek »

Something would be the url of the image you want to display.
Image
hostingebc
Posts: 28
Joined: Wed Jun 08, 2011 10:31 am

Re: Rss with image: $image value

Post by hostingebc »

jacek wrote:Something would be the url of the image you want to display.

i know, but how to get url?

I need to separate url and text in two diferent div, an then to show tem
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Rss with image: $image value

Post by jacek »

Is the URL not the same as the one you use in the img tag here

[syntax=php]echo "$naslov, $opis, $sadrzaj, $izvor,, $url, $datum1, $datum2, <img src='$urlslike'/> </br></br>";[/syntax]
Image
hostingebc
Posts: 28
Joined: Wed Jun 08, 2011 10:31 am

Re: Rss with image: $image value

Post by hostingebc »

we are lost in the translation of the last few comments on this topic

jacek wrote:Is the URL not the same as the one you use in the img tag here

[syntax=php]echo "$naslov, $opis, $sadrzaj, $izvor,, $url, $datum1, $datum2, <img src='$urlslike'/> </br></br>";[/syntax]


Trust me, this is not problem form me. I know this and andrsthend...

I will try now through the examples to be as concrete more as possible

this is content form SADRZAJ field in rss_vesti tabele (this have value of item part of rss - beginig part of body in article news like you say):
<img src="http://www.vesti-online.com/data/images/2011-06-05/156013_sampioni_kf.jpg?ver=1307647416"><br/>Upravo završena klupska sezona obeležena je potpunom dominacijom Partizana, s obzirom da su sekcije našeg najbrojnijeg sportskog društva osvojile čak 11 pehara u pet najpopularnijih kolektivnih sportova.<br/><br/>


ok.

1. How to get value "http://www.vesti-online.com/data/images/2011-06-05/156013_sampioni_kf.jpg" in $urlslike (translation - $imageurl) and

2. rest part of content form rss "Upravo završena klupska sezona obeležena je potpunom dominacijom Partizana, s obzirom da su sekcije našeg najbrojnijeg sportskog društva osvojile čak 11 pehara u pet najpopularnijih kolektivnih sportova." in $text

with $urlslike and $text i want to do the following:

[syntax=php]<div>
<div><?php echo "$urlslike; ?></div>
<div><?php echo "$text; ?></div>
</div>[/syntax]

I hope I'm far more understandable now. thanks
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Rss with image: $image value

Post by jacek »

You already have http://www.vesti-online.com/data/images ... 1307647416 in the variable $urlslike :? that is what you should use.
Image
hostingebc
Posts: 28
Joined: Wed Jun 08, 2011 10:31 am

Re: Rss with image: $image value

Post by hostingebc »

Content of article $sadrzaj is:
Atletska zvezda sa Jamajke želi da igra na Old Trafordu. Usain Bolt smatra da je dovoljno dobar da bude deo tima Aleksa Fergusona. Misli da bi trebalo da “dotera” tehniku, ali i da sada poseduje dovoljno kvaliteta da nosi dres “crvenih đavola”.

<img src="http://www.rts.rs/thumbnail/bolt-t.jpg?thumbId=1686980&amp;fileSize=56800&amp;contentType=image/pjpeg&amp;lastModified=1307717172000"


this is code how to i get image url form article $sadrzaj


[syntax=php]$test = preg_match_all('/\"(.*?)\"/', $sadrzaj, $matches);
$slika2 = str_replace( '"','',$matches[0][0]);

echo $slika2;[/syntax]

How to get text ?
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Rss with image: $image value

Post by jacek »

You could probably use

[syntax=php]strip_tags($sadrzaj);[/syntax]
as the text.
Image
hostingebc
Posts: 28
Joined: Wed Jun 08, 2011 10:31 am

Re: Rss with image: $image value

Post by hostingebc »

Greate, thanks

Problem is solved

you can see finall resolt.
http://www.moravaprom.com/ebchost/prikaz.php

Now i can make the rss blog :)
User avatar
Temor
Posts: 1186
Joined: Thu May 05, 2011 8:04 pm

Re: Rss with image: $image value

Post by Temor »

hostingebc wrote:you can see finall resolt.
http://www.moravaprom.com/ebchost/prikaz.php

404 not found
Post Reply