Hi Everyone,<br><br>Hope everyone had a good holiday and a good new year. I'm glad to be back, having suffered extreme internet withdrawl. (Ok so internet was there, but I wasn't paying £8 an hour to surf the internet!!!<br>
<br>So I also have a little problem with my perl code. It's almost there. Basically, there is an issue with it is not rotating through multiple pages as it should. It seems to read the first one, and then not increment, if that makes sense. So I post it here, in the hope that someone can help me, a perl wannabe.<br>
<br>Cheers<br><br>Stu<br><br>#!/usr/bin/perl<br><br># variables<br><br>$sites_file="sitefile.txt";  # File that holds the config <br>$use_descriptors=1; # If this is enabled, the 3rd column alt tags will be included to enhance SEO.<br>
<br># Read in the details of sites that are going to be generated.<br><br>open(sites, $sites_file) || die("Could not open file");<br>@site_array=<sites>;<br>close(sites);<br><br>    foreach $site_line (@site_array){<br>
             chomp($site_line),<br>                 ($site_description,<br>                 $site_domain,<br>                $site_img_file_src,<br>                 $site_txt_file_src,<br>                 $site_html_output_dir,<br>
                 $site_html_output_file,<br>                 $site_html_generate_meta,<br>                 $site_html_style,<br>                 $site_html_rows,<br>                 $site_html_cols)=split(/\|/,$site_line);<br>
                 <br>             push(@site_desc, $site_description);<br>            push(@site_tld, $site_domain);<br>            push(@site_html_or_img_array, $site_html_style);            <br>            push(@site_img_input_folder, $site_img_file_src);<br>
            push(@site_link_input_array, $site_txt_file_src);<br>            push(@site_html_output_folder_array, $site_html_output_dir);<br>            push(@site_html_output_file_array, $site_html_output_file);<br>            push(@site_html_input_generate_meta_array, $site_html_generate_meta);<br>
            push(@site_html_txt_or_img_array, $site_html_style);<br>            push(@site_html_rows, $site_html_rows);<br>            push(@site_html_cols, $site_html_cols);<br>    <br>            $site_inputs_count++;<br>
    }<br> <br> print "\n\n\n" . 'Site creation tool' . "\n\n\n";<br> print  'Site input file: ' . $site_txt_file_src ."\n";<br><br>    for ($current_site_counter = 0; $current_site_counter < $site_inputs_count; $current_site_counter++) {<br>
                        $data_file = @site_link_input_array[$current_site_counter]; <br>                                                <br>                        open(DAT, $data_file) || die("Could not open file!");<br>
                            @raw_data=<DAT>;<br>                        close(DAT); <br>                                               <br>    # Read in data for the page to be generated<br><br>        foreach $data_line (@raw_data){<br>
                 chomp($data_line);<br>                 ($c_jpg,$c_url,$c_descriptor)=split(/\|/,$data_line);<br>                push(@images, $c_jpg);<br>                push(@urls, $c_url);<br>                push(@descriptors, $c_descriptor);<br>
                $total_input_lines++;<br>    }<br><br>        $site_desc_out = @site_dec[$current_site_counter];<br>        $site_tld_out = @site_tld[$current_site_counter];<br>        $site_html_style_out = @site_html_or_img_array[$current_site_counter];<br>
        $fulloutputpath = @site_link_input_array[$current_site_counter];<br>        $fullimginputpath = @site_img_input_folder[$current_site_counter];<br>        $fulloutputpath= @site_html_output_folder_array[$current_site_counter] . <br>
            @site_html_output_file_array[$current_site_counter];<br>        $rows=@site_html_rows[$current_site_counter];<br>        $cols=@site_html_cols[$current_site_counter];<br>       <br>        open (outputfile, ">$fulloutputpath");    <br>
        <br>        print "\n\n\n" . "Running Input for: " .  $site_desc[$current_site_counter] . "\n";<br>        print "---------------------------------------------------------------------------";<br>
        print "\nImage Input folder is" . ': ' . $fullimginputpath ."\n";        <br>        print "Output file is" . ': ' . $fulloutputpath . "\n";<br>        <br>      print outputfile '<html>' . "\n";<br>
        print outputfile '<table border="0">' . "\n";<br>                <br>        print 'Type detected as: ';<br>        <br>        if ($site_html_style_out eq 'I') {<br>
            print "Images\n";<br>        } else {<br>            print "Text\n";<br>                }<br><br>        $total_images_required = $rows * $cols;<br><br>                for ($x = 0; $x < $rows; $x++) {                <br>
                                print outputfile "\t" . '<tr>' . "\n"; <br>                        <br>                        if ($site_html_style_out eq 'I')  {                                                            <br>
                        <br>                        for ($i = 0; $i < $cols; $i++) {<br>                                   $random_img=int(rand($total_input_lines)); <br>                        print outputfile "\t\t" . '<td>' . '<a href=' . <br>
                                "\"" . @urls[$random_img] . "\"\>"     . <br>                                '<img src=' . "\"" . $site_tld_out . @images[$random_img] . '"' . "\>" .<br>
                                '</td>' . "\n"; <br>                            }<br>                                } else {<br>                                                                <br>
                                         for ($i = 0; $i < $cols; $i++) {<br>                                            $random_img=int(rand($total_input_lines)); <br>                                            print outputfile "\t\t" . <br>
                                                '<td><a href=' . "\"" . <br>                                                    @urls[$random_img] . '">'     . <br>                                                 @images[$random_img]  . '</a>' .<br>
                                             '</td>' . "\n";<br><br>                                         }                        <br>                                }<br>                          print outputfile "\t" . '</tr>' . "\n";          <br>
                                }<br>                <br>    print outputfile '</table>' . "\n";<br>    print outputfile '</html>' . "\n\n";    <br>    }<br>    print "\n\n\n" . 'Run Completed ' . "\n\n";<br>
    close (outputfile); <br>    <br><br>