Author Topic: Snippet: cwsoft-anynews  (Read 150510 times)

Offline J.R.

  • Posts: 24
Re: Snippet: cwsoft-anynews
« Reply #200 on: March 05, 2015, 08:43:40 AM »
Stefek,

Thanks for the link.. that page makes fascinating reading and I learned a lot. But I had to laugh when I found the following code given as an example of comparative arrays on that page:


<?php
// This:
$a = array( 'color' => 'red',
            'taste' => 'sweet',
            'shape' => 'round',
            'name'  => 'apple',
            4        // key will be 0
          );

$b = array('a', 'b', 'c');


// . . .is completely equivalent with this:


$a = array();
$a['color'] = 'red';
$a['taste'] = 'sweet';
$a['shape'] = 'round';
$a['name']  = 'apple';
$a[]        = 4;        // key will be 0

$b = array();
$b[] = 'a';
$b[] = 'b';
$b[] = 'c';

// After the above code is executed, $a will be the array
// array('color' => 'red', 'taste' => 'sweet', 'shape' => 'round',
// 'name' => 'apple', 0 => 4), and $b will be the array
// array(0 => 'a', 1 => 'b', 2 => 'c'), or simply array('a', 'b', 'c').
?>


 :-) So it goes, in coding as in life...

-- J.R.

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: Snippet: cwsoft-anynews
« Reply #201 on: March 05, 2015, 06:08:51 PM »
Hello JR,

yes, those are equivalent, both.

Not as a rule, but commonly the former will be used to initialize an array and the latter to overwrite values that have been before in the array.
Of course you may as well use the latter style to generate an array from scratch (for the anyNews settings or wherever you like).

But make no mistake, you again call them comparative arrays. They are not "comparative" in the sense of data-comparision. They rather are (multidimensional) data collections with key=>value pairs where the value can itself become an array on a lower level.

Kind regards,
Stefek
"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

Offline J.R.

  • Posts: 24
Re: Snippet: cwsoft-anynews
« Reply #202 on: March 07, 2015, 08:10:39 PM »
Stefek,

I apologize for sloppy writing and calling them "comparative arrays". What I meant to say was that the symbols "=>" or "=" or "==" or "===" are all array *operators* that check the state of a variable and that in PHP each can return slightly different results depending on the types of fields being checked and a few other cases.  As far as I can tell, "===" is considered the most accurate, but for most purposes "=>" works fine.

I will be following the syntax protocol which you pointed out is the most common now that I understand it -- it's always good in coding to following the most widely used syntax when possible.

On the page you recommended I found out something else I did not realize about PHP, where it says:

"Comparing --
It is possible to compare arrays with the array_diff() function and with array operators."


I know my question has taken this thread a little off topic, so I will end by saying that prior to asking about the purpose of "=>" I had no idea there were so many different ways to say "equal to" in PHP, so this had been a very valuable discussion for me and I thank everyone who replied.  :-)

-- J.R.
« Last Edit: March 07, 2015, 08:28:34 PM by J.R. »

Offline DarkViper

  • Forum administrator
  • *****
  • Posts: 3062
  • Gender: Female
Re: Snippet: cwsoft-anynews
« Reply #203 on: March 07, 2015, 09:46:15 PM »
I apologize for sloppy writing and calling them "comparative arrays". What I meant to say was that the symbols "=>" or "=" or "==" or "===" are all array *operators* that check the state of a variable and that in PHP each can return slightly different results depending on the types of fields being checked and a few other cases.  As far as I can tell, "===" is considered the most accurate, but for most purposes "=>" works fine.

It's easy to misunderstand the syntay and meaning of =>
Normaly => is a simple 'equal or greater then' operator which compares values (==> compares values and data types).
Now a little confusion from PHP:
In case of defining an array => is a assignment operator without compare functionality.


Manuela
Der blaue Planet - er ist nicht unser Eigentum - wir haben ihn nur von unseren Nachkommen geliehen

"You have to take the men as they are… but you can not leave them like that !" :-P
Das tägliche Stoßgebet: Oh Herr, wirf Hirn vom Himmel !

Offline nibz

  • Posts: 684
  • Gender: Male
Re: Snippet: cwsoft-anynews
« Reply #204 on: June 29, 2015, 08:01:12 PM »
Updated the repo: https://github.com/WebsiteBaker-modules/anynews

Changes:
+ Updated the readme links to the correct repo.
+ Updated the module info to link to the correct github repo
+ Updated the droplet: Added possibility to select the years to display
(thanks to marmot)

Offline Gast

  • Posts: 5920
Re: Snippet: cwsoft-anynews
« Reply #205 on: June 29, 2015, 08:03:26 PM »
thx to marmot & nibz

Offline nibz

  • Posts: 684
  • Gender: Male
Re: Snippet: cwsoft-anynews
« Reply #206 on: June 29, 2015, 08:11:14 PM »
The problems now with the server are a good reason for my github project ;-).
I hope more people will join and make pull-requests to the github repo.
It's not my goal to replace the addons repo but in downtime we could at least get the latest module code :).

WebsiteBaker for the win!

Offline gnom

  • Posts: 110
Re: Snippet: cwsoft-anynews
« Reply #207 on: January 31, 2016, 10:47:40 AM »
can someone help me? I want to show only the last trhee news on start-site ... to use the droplet is no problem - but the display-mode and css :-(

want to use a slider like display-mode 4 - but it's too height - it doesn't look very nice :-(
change the width, I was able to do.. but how can I change that it's not that high as original template?


Offline Gast

  • Posts: 5920
Re: Snippet: cwsoft-anynews
« Reply #208 on: January 31, 2016, 06:22:55 PM »
can someone help me? I want to show only the last three news on start-site ... to use the droplet is no problem - but the display-mode and css :-(
want to use a slider like display-mode 4 - but it's too height - it doesn't look very nice :-(
change the width, I was able to do.. but how can I change that it's not that high as original template?

i use there the flexslider, but not sure, is this the original in the file display-mode4 or not

if yes and in my case: the flexslider builds a div around your selected news btw the content-short. this div use padding for the distance to the top, bottom, left and right
its defined in the file css/custom-settings-flexslider.css with
my example
Code: [Select]
div.newsslider1 .flexslider {
        padding:15px 15px 15px 70px;
        background: #DDEDED url(../images/news_bg.png) 10px 10px no-repeat;
}
.flexslider img {border: 2px solid #ffffff;}

newsslider is here a extra div, was better for me to configured. (so be carefull, if you use Copy&paste)
the paddings means: build a distance from the displayed text to the borders with 15px, and 70px from the left border ( i use there a small background-image)
its important, to have no fixed height for the slider, defined in the base settings of this flexslider-div, if you need a height, use min-height (its work's for shorter messages with only one line)
Code: [Select]
here my code div.mod_anynews1 .flexslider {
        max-width: 808px;
        min-height: 100px;
        background-color: #DDEDED;
        border: 1px solid #00808E;
        padding:0;
        margin:0;
        color:#000000;
}

i didnt use a definition for the max-height or height , i use there max-lenght in the droplet-call (in my case not longer then two line's - with these font on this page ~160 chars)

a good help is a plugin like firebug or webdeveloper-Toolbar to found the used settings for this box
flexslider use a basic-setting in flexslider.css in the thirdparty-folder
and a custom-settings.flexslider.css in the css-folder of this module
but its also possible to set all this in your template.css

if my post doesnt help, please post the URL to the "problem-"page here or via PM

Offline gnom

  • Posts: 110
Re: Snippet: cwsoft-anynews
« Reply #209 on: February 01, 2016, 07:16:58 AM »
thanks will try in the eventing and hope it will work.


Offline gnom

  • Posts: 110
Re: Snippet: cwsoft-anynews
« Reply #210 on: February 02, 2016, 06:48:01 PM »
hmm okay... found out now the css that makes it too "height" is in css thirdparty/flexslider ... don't want to change there something. So ... don't know what to do .. think will check it on weekend again .... or send you link.  if anyone has a "special" own template for anynews (htt-file) and the css for it - feel free to send it to me :-D thanks!

Offline cwsoft

  • Posts: 605
Re: Snippet: cwsoft-anynews
« Reply #211 on: February 03, 2016, 10:07:18 PM »
@gnom: you don't need to change the Flexslider CSS files. Just adapt cwsoft-anynews/css/flexslider-custom.css to fit your needs. This file is loaded after the original Flexslider CSS file and hence able to overwrite the defaults to your needs.

Cheers

Offline rumen

  • Posts: 424
Re: Snippet: cwsoft-anynews
« Reply #212 on: December 19, 2016, 09:50:14 PM »
I couldn't call an image I saved in /media. In custom htt template I put {GROUP_IMAGE}, but the image doesn't appear. What I did wrong?

Second the iamge can be only one for all news as group image or I can put different image in the all news and call the image with tne news?

In the attached zip file "offers" there are files files "top_offers" - how it should be (the pictures are not yet there, but it is visible where they should appear). In the "test_offers" is my result at the moment.

Regards,

Offline Gast

  • Posts: 5920
Re: Snippet: cwsoft-anynews
« Reply #213 on: December 19, 2016, 10:29:29 PM »
please use a browser tool like firebug or key F12 to look into this elements, search there for the path to the image(s)
maybe its a path like this:

Quote
src="{SYSVAR:MEDIA_REL}/you_image.jpg"

and not with the real domain adress

Offline rumen

  • Posts: 424
Re: Snippet: cwsoft-anynews
« Reply #214 on: December 19, 2016, 11:47:12 PM »
Pictures are uploaded in /media

And the code should call them from /media (as the news module see them and show them on the screen or not?).

This is the htt:

Code: [Select]
<div class="anynews">
<!-- BEGIN news_block -->
<div class="row">
<div class="col-1-3">
<div class="wrap-col">
<div class="item t-center">
<div class="item-container">
<tt></tt>{GROUP_IMAGE}<br />
</div>
<div class="item-info">

<hr />

<h3><tt></tt>{TITLE}<br /></h3>


<tt></tt>{CONTENT_SHORT}<br />
<tt></tt><p><a href="{LINK}">{TXT_READMORE}</a></p><br />
</div>
</div>
</div>
</div>



<!-- END news_block -->
</div>

Offline Gast

  • Posts: 5920
Re: Snippet: cwsoft-anynews
« Reply #215 on: December 19, 2016, 11:54:33 PM »
what i mean, is the output in your frontend with the missing pictures

Offline rumen

  • Posts: 424
Re: Snippet: cwsoft-anynews
« Reply #216 on: December 20, 2016, 12:16:14 AM »
Here is the HTML code

Code: [Select]
<div class="anynews">

<div class="row">
<div class="col-1-3">
<div class="wrap-col">
<div class="item t-center">
<div class="item-container">
<tt></tt><br>
</div>
<div class="item-info">

<hr>

<h3><tt></tt>Заглание на новина 2<br></h3>


<tt></tt><p>Тук ще сложим анонса на новина две, който също ще ни послужи, за да видим как стои на екрана.</p>
<br>
<tt></tt><p><a href="http://localhost/iwork/pages/posts/zaglanie-na-novina-2-4.php">read more</a></p><br>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-1-3">
<div class="wrap-col">
<div class="item t-center">
<div class="item-container">
<tt></tt><br>
</div>
<div class="item-info">

<hr>

<h3><tt></tt>Заглавие на новина <br></h3>


<tt></tt><p>Анонс на новина тук! Трябва да има текси, за да се вижда как изглежда анонса и т.н.</p>
<br>
<tt></tt><p><a href="http://localhost/iwork/pages/posts/zaglavie-na-novina-3.php">read more</a></p><br>
</div>
</div>
</div>
</div>
</div> <div class="row">
<div class="col-2-3">
<div class="wrap-col">
<div class="slider">
<!-- Content- Left HERE -->



<div class="clear"></div>
</div>
</div>
</div>
<div class="col-1-3">
<div class="wrap-col">
<!-- Content- Right HERE -->
</div>
</div>
</div>
</div>
</div>

Offline rumen

  • Posts: 424
Re: Snippet: cwsoft-anynews
« Reply #217 on: December 20, 2016, 12:19:09 AM »
It is very strange, but I don't see any iamge file there and the code should call the image.

Code: [Select]
<tt></tt>{GROUP_IMAGE}<br />
Maybe the code here is wrong.

Offline rumen

  • Posts: 424
Re: Snippet: cwsoft-anynews
« Reply #218 on: December 20, 2016, 10:34:53 AM »
Most probably I'm doing a simple and stupid syntax error somewhere .... Can you give me an example how the syntax should be if I have picture in /media folder called "test.jpg" in this code:

Code: [Select]
$custom_placeholder = array('IMG_LINK' => '%img%', 'MY_VAR' => '#(test)#i'

Offline dbs

  • Betatester
  • **
  • Posts: 8639
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: Snippet: cwsoft-anynews
« Reply #219 on: December 20, 2016, 10:50:07 AM »
How old is your anynews or wb?
In newest versions it looks like this
Code: [Select]
{{ news.GROUP_IMAGE }}

Offline rumen

  • Posts: 424
Re: Snippet: cwsoft-anynews
« Reply #220 on: December 20, 2016, 11:12:53 AM »
« Last Edit: December 20, 2016, 11:20:50 AM by rumen »

Offline rumen

  • Posts: 424
Re: Snippet: cwsoft-anynews
« Reply #221 on: December 20, 2016, 11:38:26 AM »
A well we have 2 codes, right? One is for use the module and the other is for htt template.

For use it:

Code: [Select]
displayNewsItems(
   $group_id = 0,
   $max_news_items = 6,
   $max_news_lenght = -1,
   $display_mode = 4,
   $lang_id = 'BG',
   $strip_tags = true,
   $allowed_tags = '<p><a><img>',
   $custom_placeholder = false,
   $sort_by = 1,
   $sort_order = 1,
   $not_older_than = 0
   );

Where I have to put custom placeholder the image I want .... and in the help file is given that example:

Code: [Select]
$custom_placeholder = array('IMG_LINK' => '%img%', 'MY_VAR' => '#(test)#i'
and we have htt template:

Code: [Select]
<div class="anynews">
<!-- BEGIN news_block -->
<div class="row">
<div class="col-1-3">
<div class="wrap-col">
<div class="item t-center">
<div class="item-container">
<tt></tt>{GROUP_IMAGE}<br />
</div>
<div class="item-info">

<hr />

<h3><tt></tt>{TITLE}<br /></h3>


<tt></tt>{CONTENT_SHORT}<br />
<tt></tt><p><a href="{LINK}">{TXT_READMORE}</a></p><br />
</div>
</div>
</div>
</div>



<!-- END news_block -->
</div>

Do you suggest to change {GROUP_IMAGE} with {{ news.GROUP_IMAGE }} in the htt file?

Offline dbs

  • Betatester
  • **
  • Posts: 8639
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: Snippet: cwsoft-anynews
« Reply #222 on: December 20, 2016, 11:41:46 AM »
Your PHP version is 5.4 or lesser i think.
Nobody should work with these old and unsecure systems like yours.
I can't help. Maybe you think about upgrading WB and modules?

Offline rumen

  • Posts: 424
Re: Snippet: cwsoft-anynews
« Reply #223 on: December 20, 2016, 12:50:14 PM »
My PHP is 5.6 but it is on my localhost under XAMPP server. After I'm ready I will transfer the site to host where I can set PHP ver. to 7 if I want. WB I can upgrade to 2.8.3-SP7 - but do you think this will resolve the issue?

Offline rumen

  • Posts: 424
Re: Snippet: cwsoft-anynews
« Reply #224 on: December 20, 2016, 01:29:27 PM »
OK I upgraded to

CMS Version 2.8.3 SP7
Revision 1646
Admin version 1.6

But the p[roblem is the same and the code table is destroied shows all cyrrilic letters as ???????? but I will fix that ... in framework/calss.database under run quiry I need to add:

Code: [Select]
$set = @mysql_query ('SET NAMES utf8');
$set = @mysql_query ('SET COLLATION_CONNECTION=utf8_general_ci');

But will need to write again everything. Thanks God is not big deals, the text is small.