Welcome to Geeklog, Anonymous Tuesday, July 08 2025 @ 01:50 pm EDT

Geeklog Forums

My random picture doesnt work on 1,4 anymore


Status: offline
Forum User
Full Member
Registered: 01/02/05
Posts: 437
it use to work on 1.3.11

is there a way to fix this issue??

 Quote

Status: offline
Forum User
Full Member
Registered: 12/29/04
Posts: 555
your error:
Error in PHP Block. Function, phpblock_rand_story_pic, does not exist.

suggests that the function you use to generate this random image is no longer in your lib-custom.php

When you upgraded you probably overwrote it.
Try looking back to an older copy and copy it over. Or search geeklog for it.

Hope this helps
 Quote

Status: offline
Forum User
Full Member
Registered: 03/09/05
Posts: 242
There any way that in addition to the image and title of the article, appears as the introduction of the article?


Greetings!! Mr. Green
 Quote

Status: offline
Forum User
Full Member
Registered: 03/09/05
Posts: 242
There any way that in addition to the image and title of the article, appears as the introduction of the article?
 Quote

Status: offline
Forum User
Full Member
Registered: 12/29/04
Posts: 555
If the rss feed from your site contains both the article and images from the article then that would be easy to do with jQuery.

-s
 Quote

Status: offline
Forum User
Full Member
Registered: 03/09/05
Posts: 242
I'm not good programming, but could you give me an example?

Greetings!! Mr. Green
 Quote

Status: offline
Forum User
Full Member
Registered: 12/29/04
Posts: 555
Text Formatted Code

<style>
    #random img {
        width: 100%;
        max-width: 200px;
        height: auto;
    }
</style>
<div id="random" align="center"></div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>
<script>
    $(document).ready(function(){
        $.get('/backend/geeklog.rss', {}, function(data){
            // Store our items in an array.
            var items = [];
            $(data).find('item').each(function(){
                items.push({
                    title: $(this).children('title').text(),
                    description: $(this).children('description').text().replace(/<script/gi, ''),
                    link: $(this).children('link').text()
                });
            });
            var i = Math.floor(Math.random()*(items.length+1));
            $('#random')
                .append($('<a />').attr('href', items[i].link)
                .append($('<img />').attr('src', $('<div />')
                .append(items[i].description).find('img').attr('src'))))
                .append($('<h2 />').text(items[i].title));
        });
    });
</script>
 

Example http://www.flashyourweb.com/random-image.php
 Quote

Status: offline
Forum User
Full Member
Registered: 03/09/05
Posts: 242
Quote by: suprsidr

Text Formatted Code

<style>
    #random img {
        width: 100%;
        max-width: 200px;
        height: auto;
    }
</style>
<div id="random" align="center"></div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>
<script>
    $(document).ready(function(){
        $.get('/backend/geeklog.rss', {}, function(data){
            // Store our items in an array.
            var items = [];
            $(data).find('item').each(function(){
                items.push({
                    title: $(this).children('title').text(),
                    description: $(this).children('description').text().replace(/<script/gi, ''),
                    link: $(this).children('link').text()
                });
            });
            var i = Math.floor(Math.random()*(items.length+1));
            $('#random')
                .append($('<a />').attr('href', items[i].link)
                .append($('<img />').attr('src', $('<div />')
                .append(items[i].description).find('img').attr('src'))))
                .append($('<h2 />').text(items[i].title));
        });
    });
</script>
 

Example http://www.flashyourweb.com/random-image.php



Excellent example, but since I can do in order that equally it appears together with the image and the title, also the text of introduction of the article (introtext)

Greetings!! Mr. Green
 Quote

Status: offline
Forum User
Full Member
Registered: 12/29/04
Posts: 555
Excellent example, but since I can do in order that equally it appears together with the image and the title, also the text of introduction of the article (introtext)

is there a question in there?

Merry Christmas
-s
 Quote

Status: offline
Forum User
Full Member
Registered: 03/09/05
Posts: 242
if it is a question, if it is possible that your example may appear as the introductory text of the article, not only the image and title, but also the introduction.

Merry Christmas
 Quote

Status: offline
Forum User
Full Member
Registered: 12/29/04
Posts: 555
So not a random image, but a random news block?
you could achieve similar creating a portal block.
Text Formatted Code

<div id="random"></div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>
<script>
    $(document).ready(function(){
        $.get('/backend/geeklog.rss', {}, function(data){
            // Store our items in an array.
            var items = [];
            $(data).find('item').each(function(){
                items.push({
                    title: $(this).children('title').text(),
                    description: $(this).children('description').text().replace(/<script/gi, ''),
                    link: $(this).children('link').text()
                });
            });
            var i = Math.floor(Math.random()*(items.length+1));
               
            $('#random')
                .append($('<h2 />').append($('<a />').attr('href', items[i].link).text(items[i].title)))
                .append($('<p />').html(items[i].description).append($('<a />').attr('href', items[i].link).text('read more...')));
        });
    });
</script>
 

I've updated the demo http://www.flashyourweb.com/random-image.php

-s
 Quote

Status: offline
Forum User
Full Member
Registered: 03/09/05
Posts: 242
If that does know, but .. is that too much to ask but how would that be?, in your example could be implemented?
 Quote

Status: offline
Forum User
Full Member
Registered: 03/09/05
Posts: 242
excellent .. thank's .. Mr. Green
 Quote

All times are EDT. The time is now 01:50 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content